开发者

Weld - Asynchronous event observers

I am using Weld to observe events. I thought there was a way to specify if the observer was asynchronous or not, but I am not fi开发者_如何学Pythonnding that annotation or documentation.

Can observers be asynchronous, if so, what do I need to do to make that happen?


There is an open request for this: CDI-31: Asynchronous events.

Depending on your requirements, you can, as indicated in your comment, set a different transactional observer: If you use AFTER_COMPLETION or AFTER_SUCCESS, it should seem to your application like an asynchronous execution. However until a framework solves , I have just found an example using JMS for asynchronous execution in CDI.


Take a look at post on Piotr Nowicki's blog http://piotrnowicki.com/2013/05/asynchronous-cdi-events/

He described a couple of methods for achieving asynchronous behavior of CDI events.


If you guys want to see this happen, you'll need to head over the the link provided in Kariem's answer and voice your opinion. It seems the expert group is unwilling to consider adding async events because they consider it bloating the spec.

Honestly, Guice manages to offer this feature, and it remains lightweight, so I find the argument against this little counter-intuitive. Nevertheless, if you want to see this feature, head to the link, voice your opinion.

-Jonathan

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜