Contact Us 1-800-596-4880

Single Resource Transactions

This version of Mule reached its End of Life on May 2, 2023, when Extended Support ended.

Deployments of new applications to CloudHub that use this version of Mule are no longer allowed. Only in-place updates to applications are permitted.

MuleSoft recommends that you upgrade to the latest version of Mule 4 that is in Standard Support so that your applications run with the latest fixes and security enhancements.

Single Resource Transactions (also known as a simple transaction or local transaction) only use a single resource to send or receive messages: JMS broker, VM queues, or JDBC connections.

The example below illustrates a flow which includes a single resource transaction performed using the source and publish operations of the JMS connector.

<flow name="asdFlow" doc:id="2a67b1ee-0394-44a8-b6d9-9ce4f94f1ae2" >
	<jms:listener config-ref="JMS_Config" destination="test.in" transactionalAction="ALWAYS_BEGIN"/>
	<!-- Other operations -->
	<jms:publish config-ref="JMS_Config" destination="test.out" transactionalAction="ALWAYS_JOIN"/>
</flow>
Both the jms:listener source and the jms:publish operation must use the same connection configuration since this mechanism is intended to manage one resource.

The example shown above defines a JMS message source that receives messages from a test.in queue and another JMS operation that sends messages to a test.out queue. The transactionalAction attribute dictates how Mule initiates a transaction. Within this flow, Mule starts a new transaction for every message it receives (jms:listener source), and always joins the transaction in progress for every message it sends (jms:publish operation).

Mule only commits messages that successfully pass through the complete flow. If at any point in the flow a message throws an error which is propagated (i.e. it is not handled by an on-error-continue), Mule rolls back the transaction. Refer to On Error Scope for details on how to handle errors.

Nested Transactions

Nested transactions are not available for Single Resource transactions. Refer to XA Transactions for more details.