I'm trying to get JBossMQ on JBoss AS 4.2.1 to participate in a JTA transaction. The client is an EJB 3.0 stateless session bean and I'm using and EJB 3.0 message driven bean to accept the messages. It appears that the messages are participating in the JTA transaction and being delivered properly (at the right time), however upon restart of JBoss the messages are being redelivered.
I've completed the steps documented in the JBoss wiki http://wiki.jboss.org/wiki/Wiki.jsp?page=ConfigJBossMQDB for changing the underlying JMS database to MySQL and I'm using the @Resource(mappedName="java:/JmsXA") connection factory in the client to generate the message.
The behaviours I'm witnessing are as follows:
1) The client client initiates the message and nothing appears in the database until the outermost Stateless session bean commits (Expected)
2) Once committed the message appears in the database with TXOP of 'A' (Expected)
3) The message driven bean receives the message after the client has committed (Expected)
4) The message has a TXOP value of 'A' and it remains 'A' until the end of the OnMessage call. Upon completion of the onMessage method the TXOP value is changed to 'D' (Expected)
5) I stop and restart JBoss, all the messages in the database are being delivered even though they have TXOP value of 'D' (Unexpected)
Some other details that may be useful, I'm sending the messages to a queue and the acknowledge mode is Auto-Acknowledge.
Any ideas where I'm going wrong? How do I prevent the message from being delivered a second time, unless there was a problem with the first delivery?
I've asked this question on the JMS forum as well (http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4067608#4067608). It was indicated to me that the before mentioned configuration is no longer valid in an EJB3 environment. Does anyone know how I configure JBossMQ with a MySQL persistence provider to participate in a JTA transaction and for the Message Driven Bean to properly remove the message from the queue upon completion?
TXOP="D" means the transaction was prepared but not committed.
Besides that, EJB3 questions are answered in the EJB3 forum.
ConfigJBossMDB is useless for EJB3 its a whole different implementation.
Nag the EJB3 developers to create a ConfigJBossMDBEJB3 like I've been
trying to do for a while now. ;-)