Feb 26th, 2008, 02:05 PM
XA and JMS - messages missing?
i am posting here as I cannot find the reason behind my app problem and I would appreciate any input. I am sure I am just missing some small change somewhere!
I have an app usiing Spring, JPA (hibernate), JMS (-> ActiveMQ).
I am using XA also and have been playing with a number of the implementations. The first impl I had working was Atomikos. All tx synch seemed to be working fine but then I noticed that eventually I was getting an error stating that the JMS session was already closed! So I assumed that I needed a jms session pool. I added the jencks-amqpool jar and config and all appeared to be working fine. However I have noticed that for some reason some/all of my jms messages are going missing, i.e. not reaching the Queue! There are no error messages appearing either. I can see from my own debug logs that all runs ok and the message should be successfully sent after the db insert. Also I can see the Transaction MAnager logging the XA debug to the server console (Jetty 6.1.5).
However once the messages stop being sent to the jms Q the XA manager debug log is reduced down to the single occurrence of XA START, XA COMMIT i.e for the DB insert. It is like the JMS session which may have been registered with the TX manager just stops participating!?!
This is really stumping me! Any suggestions appreciated.
thanks in advance
Feb 27th, 2008, 12:14 PM
How to make it work with Atomikos
To make JMS sending work with Atomikos (assuming Spring):
1-use the JmsTemplate for sending
2-make sure to set sessionTransacted=true (to avoid closed session errors)
3-use SingleConnectionFactory (Spring) to increase connection reuse
Step 2 is absolutely required because Spring will close the session otherwise.
Release 3.4 of Atomikos will make this simpler (planned for July 2008).
Mar 3rd, 2008, 04:57 AM
Pay attention at the queue size. See DeadLetterQueue en Apache ActiveMQ. When the queue is full, the messages are sended to DLQ.