5 Replies Latest reply on Jan 20, 2006 8:35 AM by Steffen Vinther

    QueueSession commits not automatically synchronized with Bea

    Steffen Vinther Newbie


      As of what I can understand, the default jms behaviour when used in transacted beans is to automatically commit/rollback the QueueSessions used when the beans transactions is committed/rollbacked

      But I can seem to get this behaviour working. In the ejbCreate method of a stateless SessionBean I setup a QueueSession like this

       jndiContext = new InitialContext();
       QueueConnectionFactory queueConnectionFactory = (QueueConnectionFactory) jndiContext.lookup("XAConnectionFactory");
       log.debug("QCF: " + queueConnectionFactory);
       Queue queue = (Queue) jndiContext.lookup(ObserverProcessor.QUEUENAME);
       queueConnection = (QueueConnection) queueConnectionFactory.createQueueConnection();
       queueSession = (QueueSession) queueConnection.createQueueSession(true, Session.AUTO_ACKNOWLEDGE);
       log.debug("Created QueueSession. Transacted=" + queueSession.getTransacted() + " / " + queueSession);
       queueSender = queueSession.createSender(queue);

      I send a message from a business method, but when the business method is committed, the message is never being sent...

      I tried using the XA interfaces as a test, XAQueueSession etc. but here the message is just send out immediately instead.

      I have set up a XA DataSource for Postgresql 8.1, that seems to get deployed ok.

      I noticed that in the file jms-ds.xml there is an entry like this
       <!-- JMS XA Resource adapter, use this to get transacted JMS in beans -->
       <adapter-display-name>JMS Adapter</adapter-display-name>
       <config-property name="SessionDefaultType" type="java.lang.String">javax.jms.Topic</config-property>
       <config-property name="JmsProviderAdapterJNDI" type="java.lang.String">java:/DefaultJMSProvider</config-property>

      And when starting jboss it seems to deploy this. Do I need to configure JMS to use that XA Resource adaptor, or am I doing something else wrong.

      Im on JBoss 3.2.7