1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
package org.mule.transport.jms.redelivery; |
8 | |
|
9 | |
import org.mule.DefaultMuleMessage; |
10 | |
import org.mule.api.MuleException; |
11 | |
import org.mule.api.MuleMessage; |
12 | |
import org.mule.api.construct.FlowConstruct; |
13 | |
import org.mule.api.endpoint.ImmutableEndpoint; |
14 | |
import org.mule.transport.jms.JmsConnector; |
15 | |
|
16 | |
import javax.jms.JMSException; |
17 | |
import javax.jms.Message; |
18 | |
|
19 | 0 | public abstract class AbstractRedeliveryHandler implements RedeliveryHandler |
20 | |
{ |
21 | |
protected JmsConnector connector; |
22 | |
|
23 | |
public abstract void handleRedelivery(Message message, ImmutableEndpoint endpoint, FlowConstruct flow) throws JMSException, MuleException; |
24 | |
|
25 | |
|
26 | |
|
27 | |
|
28 | |
|
29 | |
|
30 | |
|
31 | |
public void setConnector(JmsConnector connector) |
32 | |
{ |
33 | 0 | this.connector = connector; |
34 | 0 | } |
35 | |
|
36 | |
protected MuleMessage createMuleMessage(Message message) |
37 | |
{ |
38 | |
try |
39 | |
{ |
40 | 0 | String encoding = connector.getMuleContext().getConfiguration().getDefaultEncoding(); |
41 | 0 | return connector.createMuleMessageFactory().create(message, encoding); |
42 | |
} |
43 | 0 | catch (Exception e) |
44 | |
{ |
45 | 0 | return new DefaultMuleMessage(message, connector.getMuleContext()); |
46 | |
} |
47 | |
} |
48 | |
} |