2 Replies Latest reply on Feb 13, 2002 2:55 AM by Peter Antman

    Retry and Delay

    Nikolaj G. Newbie

      Hi there,

      Is there a generel way to make retry and delay with JMS. For example, I want to put a message back on the queue if the process failed - this should happen 3 times. Also I would want it to happen with some kind of delay... for example "wait 10 minutes" before trying again. One solution (guess) would be to make the message bean sleep (thread) for a while and then let it send a message back on the queue. It seems like a dirty trick... any other suggestions?


        • 1. Re: Retry and Delay
          Barnaby Morris Newbie

          I don't know about the delay part, but if you want to keep a count, you might have an int property in the message header that you increment each time through. You could use the javax.jms.Message get/setIntProperty() methods for this and send the message back to the same queue. When the count gets higher than 3, you do whatever error handling you want.

          • 2. Re: Retry and Delay
            Peter Antman Expert

            I guess the generall way would actually be to use the Dead Letter Queue feature. Configure it to test 3 times and us your application queue as a DLQ.

            But don't try to put the bean to sleep (no thread code in EJB, and transactions will start to time out and god knows what's more).