3 Replies Latest reply on Jul 19, 2004 10:17 AM by Les Hazlewood

    XA Messaging

    Oliver Henlich Newbie

      (Posted by jardia on behalf of Phar)

      I'm publishing to a Topic during a transaction. The basic gist of execution is as follows:

      1. Client calls method on SLSB
      2. Do some stuff
      3. Save data to db
      4. Publish JMS message to clients that data has been updated
      5. Do a little cleanup
      6. SLSB method returns (i.e. transaction commits).

      Basically, the client is getting the JMS message that was published in step 4 and then immediately calls back to the server to get some data (part of which includes the data saved in step 3).

      My problem is that when a remote VM client requests the data, the initial transaction apparently hasn't comitted yet, so their request doesn't produce the results they expect.

      Apparently this happens _really_ fast (getting the message before the initial transaction commits). I've found that if I delay the remove client request 1 second after receiving the JMS message, the data is available in the DB.

      The publisher is using the UIL2XAConnectionFactory acquired from JNDI.

      Since it is XA, I was hoping that the sends wouldn't happen until the transaction commits. By the time the client received the message, the data _would_ be in the db, and the client could immediately request the data (instead of me waiting 1 second to do so).

      I'm using JBoss 3.2.3 w/ Hibernate/Postgresql. Is the fact that Postgres's JDBC driver is not XA causing me problems?

      I am using the SpringFramework's transaction support to ensure that the the data isn't commited to the DB until the transaction commits (by using the UserTransaction in the SLSB). This is working fine (i.e. data not available until transaction commits).

      The message should only be published when the transaction commits.

      Any ideas?

      Lost,

      Phar