[cdi-dev] Update on Async event doc

Pete Muir pmuir at redhat.com
Wed Mar 18 11:19:17 EDT 2015


> On 12 Mar 2015, at 12:56, Antoine Sabot-Durand <antoine at sabot-durand.net> wrote:
> 
> Hi all,
> 
> I compiled all the feedback and decision we took regarding async events and updated the Google Doc : https://docs.google.com/document/d/1Tm_fZWS6569YqCH9lGxuqBGzS9gfupic-vv1dyKCUxk/edit?usp=sharing <https://docs.google.com/document/d/1Tm_fZWS6569YqCH9lGxuqBGzS9gfupic-vv1dyKCUxk/edit?usp=sharing>
> 
> The following point stays open. I’d like to close them (if possible) during the next meeting on Tuesday
> 
> 1) Async delivery mechanism (comment by Jozef)
> Should we write in the spec about how threads for events delivery should be used? Personally I’d rather not: I think this should be let to implementation, the specification should only describe the expected behavior (concurrency or not). now I may have missed something.
> 
> 2) Exception Handling (comment by Jozef)
> I didn’t write anything about exception and we should decide what happens if an exception occurs in an observer during async event dispatch. I think that it shouldn’t impact other observers and that we should stick to the way CompletionStage API works today.
> 
> 3) Async event activation on both ends
> We all agree that we need to explicitly fire event asynchronously on the producer side (fireAsync()). The discussion in 8.1 is about adding a way to accept async call on the consumer (observer) side.
> a) As events are often triggered in other parts of the application than the parts that consume them (most CDI framework lib fire events foe end user code) preventing user to decide if an observer can be called asynchronously could lead to issues and will prevent library developper to use fireAsync() (in a defensive coding approach).

Why?

> b) On the other hand, when placed in the same application, it’ll be very confusing for user to have to fireAsync() and enable async observer to activate this new feature.
> 
> I propose an opt-out approach. We add ‘asyncSupported' member to ‘@Observes' annotation with ‘true’ as default value. So in case of b) the end user won’t have to explicitly activate async on observer and i case of a) user detecting issue coming from async treatment of an event can explicitly declares one or more observer not compatible with async resolution with @Observes(asyncSupported=False)

That’s really messy.

> 
> 4) Support observer ordering with async events
> I think we should keep event ordering for synchronous event and ignore this feature in async event. I don’t see obvious use case to be async and ordered.
> 
> 5) Context propagation
>  I understand that propagating contexts in async event would impact easily context API. My only concern here is to be define async event to keep this feature possible.
> 
> If I forgot points please comment this mail and the doc so we can take final decision during next meeting.
> 
> Thank you
> 
> 
> Antoine
> 
> _______________________________________________
> 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/20150318/d48fd62d/attachment-0001.html 


More information about the cdi-dev mailing list