-
1. Re: Help Required - Synchronisation problem with JMS, JPA and MDB
mp911de Oct 28, 2011 1:14 AM (in response to richyclarke)Hi Richard,
the best way to deal with this is using at first a transacted JMSSession (JMSConnection.createSession(true, SESSION_TRANSACTED). The second would be using the XA on JMS (Beware: There are two JMS XA ConnectionFactories, JmsXA and XAConnectionFactory, only one of these two work properly, but currently I don't know why...).
Usually, when you do this within a managed transaction, the container commits the transaction to the resources at the end of the transaction, so everything should work fine. Manual flushing should be only an exception.
Best regards,
Mark
-
2. Re: Help Required - Synchronisation problem with JMS, JPA and MDB
richyclarke Oct 31, 2011 8:38 AM (in response to mp911de)Mark,
Thanks for the reply.
You were correct, making the JMS session transacted did the trick.
I changed my connection factory to the XA one;
connectionFactory = (ConnectionFactory) namingContact.lookup("java:JmsXA");
connection = connectionFactory.createConnection();
Then used a transacted session;
session = connection.createSession(true, Session.SESSION_TRANSACTED);
Now in my onMessage method, when I look up the the component in the database, it exists and has the changes made in the sending class.
Thanks for your help, and I hope this is useful to others.
Rich