Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
RedeliveryHandler |
|
| 1.0;1 |
1 | /* | |
2 | * $Id: RedeliveryHandler.java 20501 2010-12-08 00:52:19Z tcarlson $ | |
3 | * -------------------------------------------------------------------------------------- | |
4 | * Copyright (c) MuleSoft, Inc. All rights reserved. http://www.mulesoft.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.transport.jms.redelivery; | |
12 | ||
13 | import org.mule.api.MuleException; | |
14 | import org.mule.api.construct.FlowConstruct; | |
15 | import org.mule.api.endpoint.ImmutableEndpoint; | |
16 | import org.mule.transport.jms.JmsConnector; | |
17 | ||
18 | import javax.jms.JMSException; | |
19 | import javax.jms.Message; | |
20 | ||
21 | /** | |
22 | * <code>RedeliveryHandler</code> is used to control how redelivered messages are | |
23 | * processed by a connector. Typically, a messsage will be re-tried once or twice | |
24 | * before throwing an exception. Then the exception strategy on the connector can be | |
25 | * used to forward the message to a JMS queue or log the failure. | |
26 | */ | |
27 | public interface RedeliveryHandler | |
28 | { | |
29 | ||
30 | /** | |
31 | * The connector associated with this handler is set before | |
32 | * <code>handleRedelivery()</code> is called | |
33 | * | |
34 | * @param connector the connector associated with this handler | |
35 | */ | |
36 | public void setConnector(JmsConnector connector); | |
37 | ||
38 | /** | |
39 | * Process the redelivered message. If the JMS receiver should process the | |
40 | * message, it should be returned. Otherwise the connector should throw a | |
41 | * {@link MessageRedeliveredException} to indicate that the message should be | |
42 | * handled by the connector's exception handler. | |
43 | * | |
44 | * @param message the redelivered message | |
45 | * @param endpoint from which the message was received | |
46 | * @param flow/service in which the exception occured, this is used to obtain the appropriate exception handler | |
47 | * @throws JMSException if properties cannot be read from the JMSMessage | |
48 | * @throws MessageRedeliveredException should be thrown if the message should be | |
49 | * handled by the connection exception handler | |
50 | * @throws MuleException if there is a problem reading or proessing the | |
51 | * message | |
52 | */ | |
53 | public void handleRedelivery(Message message, ImmutableEndpoint endpoint, FlowConstruct flow) throws JMSException, MuleException; | |
54 | ||
55 | } |