[cdi-dev] Update on Async event doc
Antoine Sabot-Durand
antoine at sabot-durand.net
Thu Mar 12 08:56:16 EDT 2015
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).
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)
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/cdi-dev/attachments/20150312/e43a43e7/attachment.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 495 bytes
Desc: Message signed with OpenPGP using GPGMail
Url : http://lists.jboss.org/pipermail/cdi-dev/attachments/20150312/e43a43e7/attachment.bin
More information about the cdi-dev
mailing list