[jboss-dev-forums] [Design of Messaging on JBoss (Messaging/JBoss)] - Re: JBMESSAGING-126 -- JMS expiration

timfox do-not-reply at jboss.com
Fri Nov 17 12:48:44 EST 2006


I don't get it.

How can you handle the exception if we catch it in our layer so it never bubbles up to you?

Here is the code:


  | 
  | catch (RuntimeException e)
  |          {
  |             long id = m.getMessage().getMessageID();
  |    
  |             log.error("RuntimeException was thrown from onMessage, " + id + " will be redelivered", e);
  |             
  |             // See JMS 1.1 spec 4.5.2
  |    
  |             if (ackMode == Session.AUTO_ACKNOWLEDGE || ackMode == Session.DUPS_OK_ACKNOWLEDGE)
  |             {
  |                // We redeliver a certain number of times
  |                if (tries < maxDeliveries)
  |                {                            
  |                   tries++;
  |                }
  |                else
  |                {
  |                   log.error("Max redeliveries has occurred for message: " + m.getJMSMessageID());
  |                   
  |                   //postdeliver will do a cancel rather than an ack which will cause the ref to end
  |                   //up in the dlq
  |                   
  |                   cancel = true;
  |                   
  |                   break;
  |                }
  |             }
  |             else
  |             {
  |                // Session is either transacted or CLIENT_ACKNOWLEDGE
  |                // We just deliver next message
  |                if (trace) { log.trace("ignoring exception on " + id); }
  |                
  |                break;
  |             }
  | 
  | 

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3986933#3986933

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3986933



More information about the jboss-dev-forums mailing list