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

Claus Ibsen commented on CAMEL-1475:
------------------------------------

Maybe we can add some convention over configuration so we can auto lookup the 
SpringTransactionPolicy

So we can shorten the route to:
{code:java}
                // set the required policy for this route
                from("direct:okay").policy("PROPAGATION_REQUIRED").
                    setBody(constant("Tiger in Action")).beanRef("bookService").
                    setBody(constant("Elephant in 
Action")).beanRef("bookService");
{code}

Maybe we can have a nicer default name for {{PROPAGATION_REQUIRED}}.
{code:java}
                // set the required policy for this route
                from("direct:okay").policy("REQUIRED").
                    setBody(constant("Tiger in Action")).beanRef("bookService").
                    setBody(constant("Elephant in 
Action")).beanRef("bookService");
{code}

Or it defaults to required if no parameters specified

{code:java}
                // set the required policy for this route
                from("direct:okay").policy().
                    setBody(constant("Tiger in Action")).beanRef("bookService").
                    setBody(constant("Elephant in 
Action")).beanRef("bookService");
{code}

And while we are at it, maybe the *policy* itself could be renamed to something 
that better reflects its a transaction
{code:java}
                // this route is transacted
                from("direct:okay").transacted().
                    setBody(constant("Tiger in Action")).beanRef("bookService").
                    setBody(constant("Elephant in 
Action")).beanRef("bookService");
{code}

> transactionErrorHandler should be able to wrap routes with default policy if 
> no policy defined
> ----------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-1475
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-1475
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-core, camel-spring
>    Affects Versions: 1.6.0
>            Reporter: Claus Ibsen
>            Assignee: Claus Ibsen
>             Fix For: 2.0.0
>
>
> See TransactionalClientWithRollbackTest in camel-spring
> The {{.policy(required)}} is needed in the routes even though we have a 
> global transaction error handler with a default policy set:
> {code}
>                  errorHandler(transactionErrorHandler(required));
> {code}
> So Camel should fallback and use the global policy if the route itself does 
> not have a policy defined.

-- 
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