Weld - Asynchronous event observers

2019-06-23 16:34发布

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 finding that annotation or documentation.

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

3条回答
一夜七次
2楼-- · 2019-06-23 17:04

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

查看更多
叛逆
3楼-- · 2019-06-23 17:11

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.

查看更多
冷血范
4楼-- · 2019-06-23 17:22

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.

查看更多
登录 后发表回答