1 Reply Latest reply on Mar 17, 2010 9:31 AM by Yong Hao Gao

    Issue with a MessageConsumer attached to the DLQ.

    Jim Johnson Newbie

      We recently upgraded JBoss messaging from 1.4.5 to 1.4.6 in our JBoss AS 5.1.0 install.  This also required a JGroups upgrade.  Anyway, I'm pretty confident that the upgrade works as the entire application functions correctly (except for the described part to follow) and the bug we were looking to have fixed in the 1.4.6 version is no longer hitting us.

       

      The part that doesn't work correctly is as follows:

       

      Our application is heavily dependent on several queues.  When something catastrophic happens, stuff naturally makes its way over to the DLQ just fine.  To recover from these catastrophic failures, we wrote a utility to browse the DLQ and put messages back onto the appropriate processing queue to be retried once the root cause of the failure has been identified and fixed.

       

      This all worked great under JBoss Message 1.4.5.  The recover code is very basic code along the lines of:

       

      //Connection & Session setup.

      session.createConsumer(DLQ);

      while((message = consumer.receive(MAX_TIMEOUT)) != null) {

        //inspect message

        //recover message

      }

       

      Since switching to 1.4.6 though, that loop only ever returns 1 message, no matter how many messages are on the DLQ.  Subsequent calls to the receive hit the timeout and return null.  Interestingly, if I switch the while to a "primed" while loop, I get 2 messages.  That is:

       

      Message message = consumer.receive(MAX_TIMEOUT);

      while(message != null) {

        //inspect message

        //recover message

        message = consumer.receive(MAX_TIMEOUT);

      }

       

      That flavor will give me 2 messages.  1 from the prime, 1 from the receive inside the loop, and then the 2nd call to receive will timeout & return null.

       

      Like I said, this code worked fine w/ the previous version of JBoss Messaging.  I'm unsure if I need to do some other sort of configuration somewhere or if I'm missing something obvious here.  Does anyone have any ideas why I would be seeing this behavior now?  Thanks.