3 Replies Latest reply on Jan 23, 2007 1:36 PM by german balbastro

    MDB and connection to a remote queue with transaction

    Markus Lutum Novice

      I have the same or equal problem.

      I have 2 JBoss Servers(A and B). Both 4.0.5 with Messaging 1.0.1 GA

      On A I have an MDB listen on a local queue
      inside the onmessage it should get the message and send a Result to a Queue on Server B.

      Inside my MDB on A I create a connection using B´s JNDI and look for XAConnectionFactory.
      I open the session like this:

      session = conn.createSession(true, Session.AUTO_ACKNOWLEDGE);

      But after the onMessage returns the Message is still not in the DB on B.

      If I do it like
      session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);

      it works.

      It works also, if I use TRUE and commit the session explicitly with session.comit(); But if then an exception on A occurs I have the Message still in A and already in B.

      How can I span my JTA Transaction of Server A to include the send to B?

      Now some config stuff follows:
      My MDB Config:

      My remote send call:
      Connection conn = null;
       MessageProducer sender = null;
       try {
       conn = getConnection();
       boolean transacted = true;
       session = conn
       .createSession(transacted, Session.AUTO_ACKNOWLEDGE);
       sender = session.createProducer(sendQueue);
       TextMessage tm = session.createTextMessage(syncMessage.getMessageAsString());
       Logger.debug(this, "Message sent to IM Server");
       // with this it will be send
       // session.commit();
       } catch (JMSException e) {
       throw new RuntimeException(
       "Problems sending Sync Message to IM Server Queue.", e);
       } finally {
       if (sender != null)
       try {
       } catch (Exception ignore) {
       if (session != null)
       try {
       } catch (Exception ignore) {
       if (conn != null)
       try {
       } catch (Exception ignore) {