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 endpoints.
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 endpoint that receives on a "test.In" queue and another JMS endpoint that sends on a "test.Out" queue. The action attribute dictates how Mule initiates a transaction. Within this flow, Mule starts a new transaction will be created for every message it receives (inbound endpoint), and always joins a transaction in progress for every message it sends (outbound endpoint). 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.