1 Reply Latest reply on May 20, 2010 3:36 AM by Richard Kennard

    Can I simulate JMS_JBOSS_DO_NOT_DELIVER_BEFORE?

    Richard Kennard Novice

      Hi guys,

       

      I am really enjoying using JBoss Messaging in JBoss AS 5.1.0.GA. Thanks for all your hard work!

       

      I have a query regarding 'sending a message to the back of the queue'. I am processing messages in a cluster and sometimes a message is received but the rest of the cluster hasn't finished doing what it needs to, so that message needs to get sent to the back of the queue. Currently, I do this by just queueing up a new message.

       

      The problem is, if the queue is empty, one node in the cluster will immediately pick up that message again (even though the other nodes are still processing). I want to delay this. I tried using JMS_JBOSS_SCHEDULED_DELIVERY and that almost works, but if the queue is not empty this appears to let the new message (which I have put to the end of the queue) jump the queue in accordance with the 'scheduled delivery time'.

       

      What I need is like a JMS_JBOSS_DO_NOT_DELIVER_BEFORE. So if the queue is empty it will wait, but if the queue was full and it took a long time to get to the message anyway it will be processed as normal.

       

      Can I implement this somehow?

       

      Thanks in advance,

       

      Richard.

        • 1. Re: Can I simulate JMS_JBOSS_DO_NOT_DELIVER_BEFORE?
          Richard Kennard Novice

          To those that come this way after me...

           

          I solved this problem by sending a message with JMS_JBOSS_SCHEDULED_DELIVERY as usual, then having a little bit of code at the top of my MDB that does...

           

          if ( message.getObjectProperty( "JMS_JBOSS_SCHEDULED_DELIVERY" ) != null )

               JmsUtils.requeue( message );

           

          ...where 'requeue' puts the message back to the end of the queue, omitting the JMS_JBOSS_SCHEDULED_DELIVERY property.

           

          In effect, doing a 'delayed send to end of queue'.

           

          Richard.