[ 
https://issues.apache.org/activemq/browse/CAMEL-663?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=43959#action_43959
 ] 

Claus Ibsen commented on CAMEL-663:
-----------------------------------

You have to set the spring TransactionTemplate on this new error builder before 
it works
{code}
                TransactionTemplate tt = context.getRegistry()
                    .lookup("PROPAGATION_REQUIRED", TransactionTemplate.class);
                Policy required = new SpringTransactionPolicy(tt);

                // create the transational error handler
                TransactionErrorHandlerBuilder transError = new 
TransactionErrorHandlerBuilder();
                transError.setTransactionTemplate(tt);

                // use this error handler instead of DeadLetterChannel that is 
the default
                errorHandler(transError);

                from("direct:okay").policy(required).
                    setBody(constant("Tiger in Action")).beanRef("bookService").
                    setBody(constant("Elephant in 
Action")).beanRef("bookService");
{code}

Maybe we could have it accept a SpringTransactionPolicy object where it can get 
hold of the template.

We could also create a DSL method on SpringRouteBuilder so you could do 
something like
{code}
                errorHandler(transactionErrorHandler(required));
[code}

> create a TransactionErrorHandler so you can easily  use a transaction & 
> rollback on a route - with redeliveryDelay to just fail the route if it can't 
> be processed
> ------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-663
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-663
>             Project: Apache Camel
>          Issue Type: Improvement
>            Reporter: James Strachan
>            Assignee: James Strachan
>             Fix For: 1.4.0
>
>


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to