1
2
3
4
5
6
7
8
9
10
11 package org.mule.endpoint.outbound;
12
13 import org.mule.api.MuleEvent;
14 import org.mule.api.MuleException;
15 import org.mule.api.transaction.Transaction;
16 import org.mule.api.transaction.TransactionException;
17 import org.mule.processor.AbstractInterceptingMessageProcessor;
18 import org.mule.transaction.TransactionCoordination;
19
20
21
22
23
24 public class OutboundTxRollbackMessageProcessor extends AbstractInterceptingMessageProcessor
25 {
26 public MuleEvent process(MuleEvent event) throws MuleException
27 {
28
29 if (isTransactionRollback())
30 {
31 return event;
32 }
33 else
34 {
35 return processNext(event);
36 }
37 }
38
39
40
41
42 protected boolean isTransactionRollback()
43 {
44 try
45 {
46 Transaction tx = TransactionCoordination.getInstance().getTransaction();
47 if (tx != null && tx.isRollbackOnly())
48 {
49 return true;
50 }
51 }
52 catch (TransactionException e)
53 {
54
55 logger.warn(e.getMessage());
56 }
57 return false;
58 }
59 }