01: /*
02: * $Id: RedeliveryHandler.java 10489 2008-01-23 17:53:38Z dfeist $
03: * --------------------------------------------------------------------------------------
04: * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com
05: *
06: * The software in this package is published under the terms of the CPAL v1.0
07: * license, a copy of which has been included with this distribution in the
08: * LICENSE.txt file.
09: */
10:
11: package org.mule.transport.jms;
12:
13: import org.mule.api.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: * The connector associated with this handler is set before
28: * <code>handleRedelivery()</code> is called
29: *
30: * @param connector the connector associated with this handler
31: */
32: public void setConnector(JmsConnector connector);
33:
34: /**
35: * process the redelivered message. If the Jms receiver should process the
36: * message, it should be returned. Otherwise the connector should throw a
37: * <code>MessageRedeliveredException</code> to indicate that the message should
38: * be handled by the connector Exception Handler.
39: *
40: * @param message
41: * @throws JMSException if properties cannot be read from the JMSMessage
42: * @throws MessageRedeliveredException should be thrown if the message should be
43: * handled by the connection exception handler
44: * @throws MessagingException if there is a problem reading or proessing the
45: * message
46: */
47: public void handleRedelivery(Message message) throws JMSException,
48: MessageRedeliveredException, MessagingException;
49: }
|