Single Resource Transactions
Use a Single Resource transaction (also known as a simple transaction or local transaction) to send or receive messages using only one single resource: JMS, VM, or JDBC.
The example below illustrates a flow which includes a single resource transaction applied to inbound and outbound JMS connectors.
1 2 3 4 5 6 7 8 9 <flow name="testFlow1" doc:name="testFlow1"> <jms:inbound-endpoint queue="test.in" connector-ref="JMS" doc:name="JMS"> <jms:transaction action="ALWAYS_BEGIN"/> </jms:inbound-endpoint> .... <jms:outbound-endpoint doc:name="JMS" connector-ref="JMS" queue="test.out"> <jms:transaction action="ALWAYS_JOIN"/> </jms:outbound-endpoint> </flow>
The configuration above defines a JMS connector that receives on a "test.in" queue and another JMS connector that sends on a "test.out" queue. The action attribute dictates how Mule initiates a transaction. Within this flow, Mule starts a new transaction for every message it receives (inbound connector), and always joins a transaction in progress for every message it sends (outbound connector). Mule commits only those messages which successfully pass through the complete flow; if at any point in the flow a message throws an exception, Mule rolls back the transaction.
Refer to Transaction Management for details on how to configure a Single Resource transaction.