Mule applies the concept of http://en.wikipedia.org/wiki/Transaction_processing[transactions] to operations in application for which the result cannot remain indeterminate. In other words, where a series of steps in flow must succeed or fail as one unit, Mule uses a transaction to demarcate such a unit. For example, you might use a transaction to encapsulate several steps in a flow for which the end result involves committing information to a database. In this type of scenario, the commit is either entirely complete and succeeds, or is incomplete and it fails. Even if partially complete, the commit – or transaction – fails. Where a transaction fails, Mule rolls back the operations within the transaction so that no one part results in partial completion.
You can demarcate a transaction by applying a transaction to an endpoint. If a Mule flow begins with a transactional resource (i.e. inbound endpoint), Mule can start a new transaction and manage the entire flow as a transaction. If your flow includes a transactional outbound endpoint, Mule manages the outgoing operation as a transaction. With both a transactional inbound and outbound endpoint, Mule executes the outgoing operation as part of the transaction initiated by the inbound endpoint.
The following endpoints support transactional demarcation:
However, there may be situations in which a Mule flow begins with a non-transactional inbound endpoint – such as HTTP or SFTP – but which requires the use of a transaction within the flow. For example, a Mule flow may accept information from an external Web service, then transform the data, before charging a credit card and saving invoice information to a database. In such a situation, you can demarcate a transaction by wrapping the credit card charge and database commit operations within a transaction to ensure either complete success or complete failure and rollback.
For more information and full details about how to demarcate transactions in your Mule flow, refer to Transaction Management.