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