开发者

Is there a requirement that jms messages are sent at the end of a commit?

I have the strange phenomenon that jms messages seem to be sent before the database commit actually happened.

Lets say I have a server operation foo() which sends a message to the client when its completed. The client then loads the changed data from the server. It now appears that the jms message is sent before the commit is actually done, so t开发者_运维百科he client still gets the old data, because its request is still before the end of the original commit.

The whole server operation is definately transactional, because if an exception is thrown, the jms event is not sent.

is there any requirement in the jms specification that first all database commits have to happen, and then the jms message is to send, or is it up to the implementation in which order this happens?

We are talking about the default hornetq implementation in jboss 6.0.0.Final.

Update:

It seems I have the same problem as these guys: http://techstack.com/forum/websphere/34434-order-commits-xa-transaction.html

Update 2:

Another user with the same problem http://community.jboss.org/message/114459


You just need to make sure your Connection Factory is part of the same XA transaction.

you have to set REQUIRES_NEW on the EJB as Gursel Koca said in another post here.

The simpler will be you using the JCA Connection Factory (usually at java://JmsXA)


JMS operations are transactional, that is why jms message is delivered at commit time. If you want to see committed data, put db operations another EJB method with transactional property REQUIRES_NEW.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜