-
Book Overview & Buying
-
Table Of Contents
Apache Camel Developer's Cookbook
By :
The technique shown in the Using transactions with a database recipe used the transacted DSL statement to initiate a transaction. Using this approach, the transaction is committed when the exchange's processing completes. This recipe will show you how you can control the scope of transactions in a much more granular fashion using the policy statement.
The Java code for this recipe is located in the org.camelcookbook.transactions.transactionpolicies package. The Spring XML files are located under src/main/resources/META-INF/spring and prefixed with transactionPolicies.
Set up a SpringTransactionPolicy associated with a transaction manager as shown in the Using transactions with a database recipe.
The type of transaction manager is not relevant, as this approach applies to JDBC, JMS, and XA transactions.
Using the policy DSL statement, wrap the individual processing steps that you want to enclose in a transaction, referring to...