[cdi-dev] [JBoss JIRA] (CDI-499) Firing events asynchronously

Antoine Sabot-Durand antoine at sabot-durand.net
Wed Jan 21 10:25:44 EST 2015


My concern is too avoid creating a new EJB spec with CDI 2. Managing async operation is now very simple for end user with java 8, so do we have to add annotation to support it. I wonder. 

Antoine Sabot-Durand

> Le 21 janv. 2015 à 16:07, Werner Keil <werner.keil at gmail.com> a écrit :
> 
> Hi Antoine,
> 
> It seems the exact place for that is still to be found, but even if these are separate threads in parallel the fact that CDI 2 aims to add support for async events means anything other JSRs cannot do or don't want to do (see Bill's remark on resources in other JSRs) would fit into CDI 2 as long as the resource situation here isn't too critical either of course;-)
> 
> That's what I wanted to say.
> 
> Werner
> 
>> On Wed, Jan 21, 2015 at 4:01 PM, Antoine Sabot-Durand <antoine at sabot-durand.net> wrote:
>> Hi Werner,
>> 
>> 
>> No, it doesn’t cover @Asynchronous or @Async annotation. Discussion about async operation support in CDI 2.0 is another subject.
>> 
>> 
>>> Le 21 janv. 2015 à 13:52, Werner Keil <werner.keil at gmail.com> a écrit :
>>> 
>>> Antoine/all,
>>> 
>>> Is it safe to assume any recent discussion about an @Asynchronous annotation would be covered there unless e.g. EJB itself needs it to be updated for EE 8?
>>> 
>>> Werner
>>> 
>>>> On Wed, Jan 21, 2015 at 1:06 PM, <cdi-dev-request at lists.jboss.org> wrote:
>>>> Send cdi-dev mailing list submissions to
>>>>         cdi-dev at lists.jboss.org
>>>> 
>>>> To subscribe or unsubscribe via the World Wide Web, visit
>>>>         https://lists.jboss.org/mailman/listinfo/cdi-dev
>>>> or, via email, send a message with subject or body 'help' to
>>>>         cdi-dev-request at lists.jboss.org
>>>> 
>>>> You can reach the person managing the list at
>>>>         cdi-dev-owner at lists.jboss.org
>>>> 
>>>> When replying, please edit your Subject line so it is more specific
>>>> than "Re: Contents of cdi-dev digest..."
>>>> 
>>>> 
>>>> Today's Topics:
>>>> 
>>>>    1. [JBoss JIRA] (CDI-499) Firing events asynchronously
>>>>       (Antoine Sabot-Durand (JIRA))
>>>>    2. [JBoss JIRA] (CDI-31) Asynchronous events
>>>>       (Antoine Sabot-Durand (JIRA))
>>>>    3. [JBoss JIRA] (CDI-499) Firing events asynchronously
>>>>       (Antoine Sabot-Durand (JIRA))
>>>>    4. [JBoss JIRA] (CDI-499) Firing events asynchronously
>>>>       (Antoine Sabot-Durand (JIRA))
>>>>    5. [JBoss JIRA] (CDI-499) Firing events asynchronously
>>>>       (Jos? Paumard (JIRA))
>>>>    6. [JBoss JIRA] (CDI-499) Firing events asynchronously
>>>>       (Jozef Hartinger (JIRA))
>>>> 
>>>> 
>>>> ----------------------------------------------------------------------
>>>> 
>>>> 
>>>> Message: 6
>>>> Date: Wed, 21 Jan 2015 07:06:49 -0500 (EST)
>>>> From: "Jozef Hartinger (JIRA)" <issues at jboss.org>
>>>> Subject: [cdi-dev] [JBoss JIRA] (CDI-499) Firing events asynchronously
>>>> To: cdi-dev at lists.jboss.org
>>>> Message-ID:
>>>>         <JIRA.12561330.1421835166000.18078.1421842009269 at Atlassian.JIRA>
>>>> Content-Type: text/plain; charset=UTF-8
>>>> 
>>>> 
>>>>     [ https://issues.jboss.org/browse/CDI-499?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13034058#comment-13034058 ]
>>>> 
>>>> Jozef Hartinger commented on CDI-499:
>>>> -------------------------------------
>>>> 
>>>> {quote}For backward compatibility reason the possibility to invoke an observer asynchronously should be let to the observer{quote}
>>>> What exactly are the reasons for this? I can think of one:
>>>> - observer method injecting a @RequestScoped (or similar) bean
>>>> Are there other arguments for this?
>>>> 
>>>> {quote}3. Observer bound to a transaction phase
>>>> these observer will be invoked in the right transaction phase but asynchronously{quote}
>>>> How's that different from Event.fire()?
>>>> 
>>>> > Firing events asynchronously
>>>> > -----------------------------
>>>> >
>>>> >                 Key: CDI-499
>>>> >                 URL: https://issues.jboss.org/browse/CDI-499
>>>> >             Project: CDI Specification Issues
>>>> >          Issue Type: Feature Request
>>>> >          Components: Events
>>>> >    Affects Versions: 1.2.Final
>>>> >            Reporter: Antoine Sabot-Durand
>>>> >
>>>> > We should allow a way to fire event asynchronously. This mechanism should leverage new async API in JDK8 especially the {{CompletionStage}} interface.
>>>> > Our proposal is:
>>>> > h2. 1. Add {{fireAsync()}} method to {{Event}} and {{BeanManager}}
>>>> > Signature of the method on {{Event<T>}} would be
>>>> > {code:java}
>>>> > <U extends T> CompletionStage<U> fireAsync(U event);
>>>> > {code}
>>>> > Signature on {{BeanManager}} would be
>>>> > {code:java}
>>>> > <T> CompletionStage<T> fireAsyncEvent(T event, Annotation... qualifiers)
>>>> > {code}
>>>> > h2. 2. Add an {{asyncSupported()}} member to {{@Observes}}
>>>> > For backward compatibility reason the possibility to invoke an observer asynchronously should be let to the observer (legacy observers should be called synchronously). We propose to add the boolean {{asyncSupported()}} member with the {{false}} default value to support this backward compatibility aspect.
>>>> > So to be notified asynchronously an observer should have {{asyncSupported}} member to true. otherwise it will be called synchronously.
>>>> > h2. 3. Observer bound to a transaction phase
>>>> > these observer will be invoked in the right transaction phase but asynchronously
>>>> > h2. 4. Event Ordering
>>>> > Should we decide to add events ordering in CDI 2.0, the order will be keep in asynchronous observer notification. If there are a mix of synchronous and asynchronous observer, asynchronous will be called first in order, then synchronous in their order (async has priority on sync).
>>>> > h2. 5. Event state (payload mutability)
>>>> > We'll keep payload mutability with async events (but should explicitly specify it). That means  that we should guarantee the event state consistency between observers and in case of ordered observers the fact that observer N+1 get the event state at the end of observer N.
>>>> 
>>>> 
>>>> 
>>>> --
>>>> This message was sent by Atlassian JIRA
>>>> (v6.3.11#6341)
>>>> 
>>>> 
>>>> ------------------------------
>>>> 
>>>> _______________________________________________
>>>> cdi-dev mailing list
>>>> cdi-dev at lists.jboss.org
>>>> https://lists.jboss.org/mailman/listinfo/cdi-dev
>>>> 
>>>> Note that for all code provided on this list, the provider licenses the code under the Apache License, Version 2 (http://www.apache.org/licenses/LICENSE-2.0.html).  For all other ideas provided on this list, the provider waives all patent and other intellectual property rights inherent in such information.
>>>> 
>>>> End of cdi-dev Digest, Vol 50, Issue 42
>>>> ***************************************
>>> 
>>> _______________________________________________
>>> cdi-dev mailing list
>>> cdi-dev at lists.jboss.org
>>> https://lists.jboss.org/mailman/listinfo/cdi-dev
>>> 
>>> Note that for all code provided on this list, the provider licenses the code under the Apache License, Version 2 (http://www.apache.org/licenses/LICENSE-2.0.html). For all other ideas provided on this list, the provider waives all patent and other intellectual property rights inherent in such information.
> 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/cdi-dev/attachments/20150121/3ffd155b/attachment-0001.html 


More information about the cdi-dev mailing list