开发者

How to post new JMS Messages asynchronously after processing an inbound Message?

We have a scenario where, after 开发者_运维问答processing an incoming message A with a Message-Driven Bean, we write a follow-up message B to another queue. We are using Glassfish 3.1.

One goal in this case is that posting message B can take place asynchronously, and does not need to be reliable - meaning, if after processing message A we attempt to post message B and it fails, we do not roll back the processing for message A.

A second goal is that posting message B should not block or extend the scope of the transaction covering message A. We would like the transaction covering message A to be closed as soon as possible and not be held open while message B is being processed.

One idea is to create a special EJB with a method marked @Asynchronous for this purpose, and looking up and invoking that EJB at the end of onMessage(). We're not sure if that is the best practice in this case, however.

We aren't interested in bringing in an extra orchestration solution (e.g. ESB) that would handle this and more complex cases.


Have you tried it?

My understanding is that MDB's are in their own transactions. So a problem with B isn't going to roll A back. This should be the default behavior.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜