6 Replies Latest reply on Jul 6, 2011 1:06 PM by nadiafern

    Message Redelivery not working.  .

    nadiafern

      I am using JBoss 5.1.0 GA. . I have a simple non transacted queue using the client Ack mode.

      For the queue configuration i am using all out of the box settings.

       

      When i read a message from the queue i process it. If i get an exception then in the catch i call the session.recover so as to redeliver this message when the queue is read again. However i dont see this behaviour. Once i read the message even though i have not acknowledged I dont recieve this message again when i read the queue again inspite of calling the session.recover().

       

      what am i missing here. Any input would be greatly appreiciated.

      I have tired everything and i cant get this to work

       

      PS: We support multiple appServers and the same code works just fine for Weblogic 10.3

        • 1. Re: Message Redelivery not working.  .
          mp911de

          Hi there,

          you can configure redelivery retries in messaging-service.xml (DefaultMaxDeliveryAttempts) and MaxDeliveryAttempts per each queue/topic.

           

          Best regards,

          Mark

          • 2. Re: Message Redelivery not working.  .
            nadiafern

            I have configured the DefaultMaxDeliveryAttempts on the messaging-service.xml as well as the MaxDeliveryAttempts for the queue. I reading the queue synchronously using the receivenowait method. I see that there was a lot of discussion around this on the forum. Is there any specific configuration that I need to make in order for message RE-delivery to work when using the receivenowait that i may have missed.

            Any help or inputs that i can try would be greatly appereciated.

             

             

             

             

             

            • 3. Re: Message Redelivery not working.  .
              mp911de

              do you call Message.acknowledge() before your Exception is thrown? i.e

               

              messacke.acknowledge();

              try{

              ...(something throws exception)

              }catch(Exception e)

              log.log(e.getMessage(), e);

              throw new JMSException(e);

              }

               

              PS: did you look in the DLQ (DeadLetter-Queue) if you'll find your messages there?

              • 4. Re: Message Redelivery not working.  .
                nadiafern

                Thank you for replying to my post. This is how i have the logic :

                 

                In success scenario :

                 

                1) Read the queue : Message message =  receiver.receiveNoWait();

                2) Is message is not null then process it.

                3) If no exception then call :message.acknowledge();

                 

                In Failure Scenario:

                 

                1) Read the queue : Message message =  receiver.receiveNoWait();

                2) Is message is not null then process it.

                3) If there is an  exception then call :session.recover() so as to redeliver the message again.

                 

                I find that once I read the message from the queue it just gets lost. I dont see any entry in the DLQ as well.

                This is what i have configured on the messaging-service.xml

                <attribute name="DefaultDLQ">jboss.messaging.destination:service=Queue,name=DLQ</attribute>
                     
                      <!-- The default maximum number of times to attempt delivery of a message before sending to the DLQ (if configured).
                           This can be overridden on a per destinatin basis -->
                     
                      <attribute name="DefaultMaxDeliveryAttempts">10</attribute>
                     
                      <!-- The default Expiry Queue to use for destinations. This can be overridden on a per destinatin basis -->
                     
                      <attribute name="DefaultExpiryQueue">jboss.messaging.destination:service=Queue,name=ExpiryQueue</attribute>
                     
                      <!-- The default redelivery delay to impose. This can be overridden on a per destination basis -->
                     
                      <attribute name="DefaultRedeliveryDelay">50</attribute>
                     

                 

                • 5. Re: Message Redelivery not working.  .
                  mp911de

                  Hmmm...strange. I used redelivery with MessageDriven beans in a transactional context. I looked up the javadoc for CLIENT_ACKNOWLEDGE and it says:

                   

                   

                  With this acknowledgment mode, the client acknowledges a consumed message by calling the message's acknowledge method. Acknowledging a consumed message acknowledges all messages that the session has consumed. (see http://download.oracle.com/javaee/5/api/javax/jms/Session.html#CLIENT_ACKNOWLEDGE)

                   

                  Don't know, whether this behavior is fine for all use cases. Have you tried to use JMS in a transacted mode? If you need the way you use it, i don't have any further ideas, sorry.

                  • 6. Re: Message Redelivery not working.  .
                    nadiafern

                    I will try to use JMS in a transacted mode . Will let you know what I find but i think this is the issue. Thanks Mark for all your help on this issue.