Nav
You are viewing an older version of this topic. To go to a different version, use the version menu at the upper-right. +

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.

This is a single resource transaction because both JMS connectors are referencing the same JMS global element.
You can join multiple endpoints on a same transaction only if they all refer the same element.

Refer to Transaction Management for details on how to configure a Single Resource transaction.

We use cookies to make interactions with our websites and services easy and meaningful, to better understand how they are used and to tailor advertising. You can read more and make your cookie choices here. By continuing to use this site you are giving us your consent to do this.

+