Using transactions with a database
This recipe will show you how to set up transaction management over a database used from a Camel route. It will also detail the transaction propagation behaviors that you can use to combine both transactional and non-transactional database interactions.
Getting ready
The Java code for this recipe is located in the org.camelcookbook.transactions.databasetransaction
package. The Spring XML files are located under src/main/resources/META-INF/spring
and prefixed with databaseTransaction
.
As discussed in the Introduction section, Camel's transaction handling relies on Spring's PlatformTransactionManager
abstraction. Therefore, it is necessary to include the appropriate dependency in your application regardless of whether ...
Get Apache Camel Developer's Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.