2 Replies Latest reply on Jun 24, 2007 6:43 AM by niefeng

    HA JMS & message selector

    niefeng

      Hi all,

      I have configured the queue as the HA JMS which will be running in the master node. In my topology, i have two nodes within the cluster. My box is jboss 4.0.5 GA. OS solaris 10. DB Oracle 10g. JVM: JRE 1.5.10

      Could I know the behaviour of the jms msg by specifying the message selector?

      let say in node 1, i tagged with the msg with node1 ID so that i can ensure only the MD bean deployed in node1 can receive that msg. Same for node2 which its MD bean will be receive those jms msg that tagged with node2 ID also.

      However, sometime the msg that tagged with node1 ID is not received by node1 and neither node2. I try to check whether the msg stuck in the queue, but it is not the case. The queue showing empty msg.

      Is it because the jms msg that tagged with the node1 ID has been delivered to node2? and the node2 will not proceed it and the msg is removed from the queue?


      Many thanks

        • 1. Re: HA JMS & message selector
          brian.stansberry

          If you added a selector on the MDB and a message doesn't match, the message shouldn't be discarded; it should remain in the queue. The fact that there is a cluster involved shouldn't affect this at all.

          Suggest you search the JMS forums for any similar issue and if you can't find anything, post there.

          • 2. Re: HA JMS & message selector
            niefeng

            here is the exception i got in node1

            org.jboss.mq.SpyXAException: Resource manager error during prepare; - nested throwable: (javax.jms.IllegalStateException: The connection is closed)
             at org.jboss.mq.SpyXAException.getAsXAException(SpyXAException.java:72)
             at org.jboss.mq.SpyXAResource.prepare(SpyXAResource.java:151)
             at org.jboss.tm.TransactionImpl$Resource.prepare(TransactionImpl.java:2212)
             at org.jboss.tm.TransactionImpl.prepareResources(TransactionImpl.java:1660)
             at org.jboss.tm.TransactionImpl.commit(TransactionImpl.java:347)
             at org.jboss.tm.TxManager.commit(TxManager.java:240)
             at org.jboss.jms.asf.StdServerSession.onMessage(StdServerSession.java:351)
             at org.jboss.mq.SpyMessageConsumer.sessionConsumerProcessMessage(SpyMessageConsumer.java:905)
             at org.jboss.mq.SpyMessageConsumer.addMessage(SpyMessageConsumer.java:170)
             at org.jboss.mq.SpySession.run(SpySession.java:323)
             at org.jboss.jms.asf.StdServerSession.run(StdServerSession.java:194)
             at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:743)
             at java.lang.Thread.run(Unknown Source)
            Caused by: javax.jms.IllegalStateException: The connection is closed
             at org.jboss.mq.Connection.checkClosed(Connection.java:1244)
             at org.jboss.mq.Connection.send(Connection.java:1104)
             at org.jboss.mq.SpyXAResourceManager.prepare(SpyXAResourceManager.java:255)
             at org.jboss.mq.SpyXAResource.prepare(SpyXAResource.java:147)
             ... 11 more
            [14:06:07-22:24:39,779] [ WARN:org.jboss.tm.TransactionImpl] [JMS SessionPool Worker-6] XAException: tx=TransactionImpl:XidImpl[FormatId=257, GlobalId=asterix/809, BranchQual=, localId=809] errorCode=XAER_RMERR
            org.jboss.mq.SpyXAException: Resource manager error during rollback; - nested throwable: (javax.jms.IllegalStateException: The connection is closed)
             at org.jboss.mq.SpyXAException.getAsXAException(SpyXAException.java:72)
             at org.jboss.mq.SpyXAResource.rollback(SpyXAResource.java:182)
             at org.jboss.tm.TransactionImpl$Resource.rollback(TransactionImpl.java:2277)
             at org.jboss.tm.TransactionImpl.rollbackResources(TransactionImpl.java:1837)
             at org.jboss.tm.TransactionImpl.commit(TransactionImpl.java:368)
             at org.jboss.tm.TxManager.commit(TxManager.java:240)
             at org.jboss.jms.asf.StdServerSession.onMessage(StdServerSession.java:351)
             at org.jboss.mq.SpyMessageConsumer.sessionConsumerProcessMessage(SpyMessageConsumer.java:905)
             at org.jboss.mq.SpyMessageConsumer.addMessage(SpyMessageConsumer.java:170)
             at org.jboss.mq.SpySession.run(SpySession.java:323)
             at org.jboss.jms.asf.StdServerSession.run(StdServerSession.java:194)
             at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:743)
             at java.lang.Thread.run(Unknown Source)
            Caused by: javax.jms.IllegalStateException: The connection is closed
             at org.jboss.mq.Connection.checkClosed(Connection.java:1244)
             at org.jboss.mq.Connection.send(Connection.java:1104)
             at org.jboss.mq.SpyXAResourceManager.rollback(SpyXAResourceManager.java:308)
             at org.jboss.mq.SpyXAResource.rollback(SpyXAResource.java:178)
             ... 11 more
            [14:06:07-22:24:39,788] [ERROR:org.jboss.jms.asf.StdServerSession] [JMS SessionPool Worker-6] failed to commit/rollback
            org.jboss.tm.JBossRollbackException: Unable to commit, tx=TransactionImpl:XidImpl[FormatId=257, GlobalId=asterix/809, BranchQual=, localId=809] status=STATUS_NO_TRANSACTION; - nested throwable: (org.jboss.mq.SpyXAException: Resource manager error during prepare; - nested throwable: (javax.jms.IllegalStateException: The connection is closed))
             at org.jboss.tm.TransactionImpl.commit(TransactionImpl.java:372)
             at org.jboss.tm.TxManager.commit(TxManager.java:240)
             at org.jboss.jms.asf.StdServerSession.onMessage(StdServerSession.java:351)
             at org.jboss.mq.SpyMessageConsumer.sessionConsumerProcessMessage(SpyMessageConsumer.java:905)
             at org.jboss.mq.SpyMessageConsumer.addMessage(SpyMessageConsumer.java:170)
             at org.jboss.mq.SpySession.run(SpySession.java:323)
             at org.jboss.jms.asf.StdServerSession.run(StdServerSession.java:194)
             at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:743)
             at java.lang.Thread.run(Unknown Source)
            Caused by: org.jboss.mq.SpyXAException: Resource manager error during prepare; - nested throwable: (javax.jms.IllegalStateException: The connection is closed)
             at org.jboss.mq.SpyXAException.getAsXAException(SpyXAException.java:72)
             at org.jboss.mq.SpyXAResource.prepare(SpyXAResource.java:151)
             at org.jboss.tm.TransactionImpl$Resource.prepare(TransactionImpl.java:2212)
             at org.jboss.tm.TransactionImpl.prepareResources(TransactionImpl.java:1660)
             at org.jboss.tm.TransactionImpl.commit(TransactionImpl.java:347)
             ... 8 more
            Caused by: javax.jms.IllegalStateException: The connection is closed
             at org.jboss.mq.Connection.checkClosed(Connection.java:1244)
             at org.jboss.mq.Connection.send(Connection.java:1104)
             at org.jboss.mq.SpyXAResourceManager.prepare(SpyXAResourceManager.java:255)
             at org.jboss.mq.SpyXAResource.prepare(SpyXAResource.java:147)



            And I also realize that the jms msg has been moved to DLQ due to too many resend, that's why I can't find the msg neither in node1 and node2.


            Below is the pseudo code on how i initiating the sending of jms msg:

            private void initArchive()
            {
             //delegate to other component using jms
             sendArchiveRequest();
            
             //start archive: the execution time can be more than 10 minutes and
             //is an intensive operation
             archive();
            }
            
            


            The caller of this method is an MDBean, and this method is resided under a nomal java class. The sending of the jms is not involved any session bean.

            I managed to resolved it by delegating the sending of the jms msg to a SLSB with transaction attr "RequiresNew".