December 2013
Intermediate to advanced
424 pages
9h 7m
English
So far we have seen transaction success or failure determined naturally—that is, by whether an exchange was successfully processed, or if an exception was thrown during its processing. This recipe will provide you with a number of additional options around controlling transaction rollback.
The Java code for this recipe is located in the org.camelcookbook.transactions.rollback package. The Spring XML files are located under src/main/resources/META-INF/spring and prefixed with rollback.
You can use the rollback DSL statement to throw an exception with an optional message.
In the XML DSL, we use the following code:
<from uri="direct:transacted"/> <transacted/> <setHeader headerName="message"> <simple>${body}</simple> ...Read now
Unlock full access