View Javadoc

1   /*
2    * $Id: RedeliveryHandler.java 7976 2007-08-21 14:26:13Z dirk.olmes $
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.com
5    *
6    * The software in this package is published under the terms of the CPAL v1.0
7    * license, a copy of which has been included with this distribution in the
8    * LICENSE.txt file.
9    */
10  
11  package org.mule.providers.jms;
12  
13  import org.mule.umo.MessagingException;
14  
15  import javax.jms.JMSException;
16  import javax.jms.Message;
17  
18  /**
19   * <code>RedeliveryHandler</code> is used to control how redelivered messages are
20   * processed by a connector. Typically, a messsage will be re-tried once or twice
21   * before throwing an exception. Then the ExceptionStrategy on the connector can be
22   * used to forward the message to a JMS queue or log the failure.
23   */
24  public interface RedeliveryHandler
25  {
26  
27      /**
28       * The connector associated with this handler is set before
29       * <code>handleRedelivery()</code> is called
30       * 
31       * @param connector the connector associated with this handler
32       */
33      public void setConnector(JmsConnector connector);
34  
35      /**
36       * process the redelivered message. If the Jms receiver should process the
37       * message, it should be returned. Otherwise the connector should throw a
38       * <code>MessageRedeliveredException</code> to indicate that the message should
39       * be handled by the connector Exception Handler.
40       * 
41       * @param message
42       * @throws JMSException if properties cannot be read from the JMSMessage
43       * @throws MessageRedeliveredException should be thrown if the message should be
44       *             handled by the connection exception handler
45       * @throws MessagingException if there is a problem reading or proessing the
46       *             message
47       */
48      public void handleRedelivery(Message message)
49          throws JMSException, MessageRedeliveredException, MessagingException;
50  }