[cdi-dev] [JBoss JIRA] (CDI-650) Introduce asynchronous event notification options

Emily Jiang (JIRA) issues at jboss.org
Wed Nov 23 17:33:00 EST 2016


    [ https://issues.jboss.org/browse/CDI-650?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13327486#comment-13327486 ] 

Emily Jiang commented on CDI-650:
---------------------------------

With the introduction of NotificationOptions, the emitter can put more info inside to instruct the container. We will have to spec for each individual properties, right? Otherwise, the application is not portable any more, as Weld might react different from OWB on treating the NotificationOptions info. I might totally misunderstand you. 

> Introduce asynchronous event notification options
> -------------------------------------------------
>
>                 Key: CDI-650
>                 URL: https://issues.jboss.org/browse/CDI-650
>             Project: CDI Specification Issues
>          Issue Type: Feature Request
>            Reporter: Martin Kouba
>            Assignee: Martin Kouba
>             Fix For: 2.0 .Final
>
>
> Currently, it's only possible to provide a custom executor when firing an event asynchronously - see also {{javax.enterprise.event.Event.fireAsync(U, Executor)}}. It might be useful to provide other implementation-specific options, e.g. notification timeout.
> Therefore, I suggest to introduce {{NotificationOptions}} interface:
> {code:java}
> public interface NotificationOptions {
>     Executor getExecutor();
>     // Implementation-specific options
>     Object get(String optionName);
> }
> {code}
> and change the method signature to:
> {code:java}
> <U extends T> CompletionStage<U>  fireAsync(U event, NotificationOptions options);
> {code}
> In the future, if any implementation-specific configuration proves to be useful and worth standardizing, we may simply add a new method to {{NotificationOptions}}, e.g. 
> {code:java}
> Duration getTimeout();
> {code}
> instead of adding more and more params to {{Event.fireAsync()}}.
> We could also introduce some convenient static methods on {{NotificationOptions}}, e.g.:
> {code:java}
> void fireEvents(Event event, Executor executor) {
>     event.fireAsync(new Foo(), NotificationOptions.ofExecutor(executor));
> }
> {code}



--
This message was sent by Atlassian JIRA
(v7.2.3#72005)


More information about the cdi-dev mailing list