You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Erwin Etchart <er...@gmail.com> on 2013/09/26 17:55:27 UTC

Camel multicast and exception

Based on this example of a camel route

    <aggregate id="ag.2" strategyRef="second.aggregator.strategy"
aggregationRepositoryRef="aggregator.container.2" completionSize="2"
completionTimeout="360000">
                            <correlationExpression>
                                <header>aggregationKey</header>
                            </correlationExpression>
                            <multicast stopOnException="false"  >
                                <to uri="direct:1.IN.SPRING.REMOTING" />
                                <to uri="direct:2.IN.SPRING.REMOTING" />
                                <to uri="direct:3.IN.SPRING.REMOTING" />
                            </multicast>
     </aggregate>



    <route autoStartup="true"   >
        <from uri="direct:1.IN.SPRING.REMOTING" />
        <transform>
            <method bean="converter" method="toTestRequest"/>
        </transform>
        <to uri="bean:spring.remote?method=springRemotingTest(${body})"  />
        <onCompletion onCompleteOnly="true" >
            <process ref="post.processor" />
            <to uri="jms:COMPLETED" />
        </onCompletion>

    </route>

        <route autoStartup="true"  >
        <from uri="direct:2.IN.SPRING.REMOTING" />
        <transform>
            <method bean="converter" method="toTestRequest"/>
        </transform>
        <to uri="bean:spring.remote?method=springRemotingTest2(${body})" />
        <onCompletion onCompleteOnly="true" >
            <process ref="post.processor" />
            <to uri="jms:COMPLETED" />
        </onCompletion>

    </route>


    <route autoStartup="true"   >
        <from uri="direct:3.IN.SPRING.REMOTING" />
        <transform>
            <method bean="converter" method="toTestRequest"/>
        </transform>
        <to uri="bean:spring.remote?method=springRemotingTest3(${body})" />
        <onCompletion onCompleteOnly="true"  >
            <process ref="post.processor" />
            <to uri="jms:COMPLETED" />
        </onCompletion>
    </route>

I want to retry independent from each other if one fails. The behavior now
is if one fails the three routes will be retried. I tried to do a custom
error hander but the behavior was the same.

¿Any idea?

Best regards

Erwin

Re: Camel multicast and exception

Posted by Erwin Etchart <er...@gmail.com>.
Thanks , i will try that.

Regards

Erwin


2013/9/26 Christian Posta <ch...@gmail.com>

> You can specify an error handler for the specific route which is where you
> specify redelivery semantics:
>
> http://camel.apache.org/error-handler.html
>
>
> On Thu, Sep 26, 2013 at 9:33 AM, Erwin Etchart <erwin.etchart@gmail.com
> >wrote:
>
> > Thanks for your response Christian,
> >
> > Do you know if i try with "try catch" how can i do to define a
>  redelivery
> > police of this specific direct component?
> >
> >
> > Regards
> >
> > Erwin
> >
> >
> >
> >
> > 2013/9/26 Christian Posta <ch...@gmail.com>
> >
> > > Take a look at try-catch block. Or try adding exception handlers to
> each
> > > individual "direct" route?
> > >
> > >
> > > On Thu, Sep 26, 2013 at 8:55 AM, Erwin Etchart <
> erwin.etchart@gmail.com
> > > >wrote:
> > >
> > > > Based on this example of a camel route
> > > >
> > > >     <aggregate id="ag.2" strategyRef="second.aggregator.strategy"
> > > > aggregationRepositoryRef="aggregator.container.2" completionSize="2"
> > > > completionTimeout="360000">
> > > >                             <correlationExpression>
> > > >                                 <header>aggregationKey</header>
> > > >                             </correlationExpression>
> > > >                             <multicast stopOnException="false"  >
> > > >                                 <to uri="direct:1.IN.SPRING.REMOTING"
> > />
> > > >                                 <to uri="direct:2.IN.SPRING.REMOTING"
> > />
> > > >                                 <to uri="direct:3.IN.SPRING.REMOTING"
> > />
> > > >                             </multicast>
> > > >      </aggregate>
> > > >
> > > >
> > > >
> > > >     <route autoStartup="true"   >
> > > >         <from uri="direct:1.IN.SPRING.REMOTING" />
> > > >         <transform>
> > > >             <method bean="converter" method="toTestRequest"/>
> > > >         </transform>
> > > >         <to
> uri="bean:spring.remote?method=springRemotingTest(${body})"
> > >  />
> > > >         <onCompletion onCompleteOnly="true" >
> > > >             <process ref="post.processor" />
> > > >             <to uri="jms:COMPLETED" />
> > > >         </onCompletion>
> > > >
> > > >     </route>
> > > >
> > > >         <route autoStartup="true"  >
> > > >         <from uri="direct:2.IN.SPRING.REMOTING" />
> > > >         <transform>
> > > >             <method bean="converter" method="toTestRequest"/>
> > > >         </transform>
> > > >         <to
> > uri="bean:spring.remote?method=springRemotingTest2(${body})"
> > > />
> > > >         <onCompletion onCompleteOnly="true" >
> > > >             <process ref="post.processor" />
> > > >             <to uri="jms:COMPLETED" />
> > > >         </onCompletion>
> > > >
> > > >     </route>
> > > >
> > > >
> > > >     <route autoStartup="true"   >
> > > >         <from uri="direct:3.IN.SPRING.REMOTING" />
> > > >         <transform>
> > > >             <method bean="converter" method="toTestRequest"/>
> > > >         </transform>
> > > >         <to
> > uri="bean:spring.remote?method=springRemotingTest3(${body})"
> > > />
> > > >         <onCompletion onCompleteOnly="true"  >
> > > >             <process ref="post.processor" />
> > > >             <to uri="jms:COMPLETED" />
> > > >         </onCompletion>
> > > >     </route>
> > > >
> > > > I want to retry independent from each other if one fails. The
> behavior
> > > now
> > > > is if one fails the three routes will be retried. I tried to do a
> > custom
> > > > error hander but the behavior was the same.
> > > >
> > > > ¿Any idea?
> > > >
> > > > Best regards
> > > >
> > > > Erwin
> > > >
> > >
> > >
> > >
> > > --
> > > *Christian Posta*
> > > http://www.christianposta.com/blog
> > > twitter: @christianposta
> > >
> >
>
>
>
> --
> *Christian Posta*
> http://www.christianposta.com/blog
> twitter: @christianposta
>

Re: Camel multicast and exception

Posted by Christian Posta <ch...@gmail.com>.
You can specify an error handler for the specific route which is where you
specify redelivery semantics:

http://camel.apache.org/error-handler.html


On Thu, Sep 26, 2013 at 9:33 AM, Erwin Etchart <er...@gmail.com>wrote:

> Thanks for your response Christian,
>
> Do you know if i try with "try catch" how can i do to define a  redelivery
> police of this specific direct component?
>
>
> Regards
>
> Erwin
>
>
>
>
> 2013/9/26 Christian Posta <ch...@gmail.com>
>
> > Take a look at try-catch block. Or try adding exception handlers to each
> > individual "direct" route?
> >
> >
> > On Thu, Sep 26, 2013 at 8:55 AM, Erwin Etchart <erwin.etchart@gmail.com
> > >wrote:
> >
> > > Based on this example of a camel route
> > >
> > >     <aggregate id="ag.2" strategyRef="second.aggregator.strategy"
> > > aggregationRepositoryRef="aggregator.container.2" completionSize="2"
> > > completionTimeout="360000">
> > >                             <correlationExpression>
> > >                                 <header>aggregationKey</header>
> > >                             </correlationExpression>
> > >                             <multicast stopOnException="false"  >
> > >                                 <to uri="direct:1.IN.SPRING.REMOTING"
> />
> > >                                 <to uri="direct:2.IN.SPRING.REMOTING"
> />
> > >                                 <to uri="direct:3.IN.SPRING.REMOTING"
> />
> > >                             </multicast>
> > >      </aggregate>
> > >
> > >
> > >
> > >     <route autoStartup="true"   >
> > >         <from uri="direct:1.IN.SPRING.REMOTING" />
> > >         <transform>
> > >             <method bean="converter" method="toTestRequest"/>
> > >         </transform>
> > >         <to uri="bean:spring.remote?method=springRemotingTest(${body})"
> >  />
> > >         <onCompletion onCompleteOnly="true" >
> > >             <process ref="post.processor" />
> > >             <to uri="jms:COMPLETED" />
> > >         </onCompletion>
> > >
> > >     </route>
> > >
> > >         <route autoStartup="true"  >
> > >         <from uri="direct:2.IN.SPRING.REMOTING" />
> > >         <transform>
> > >             <method bean="converter" method="toTestRequest"/>
> > >         </transform>
> > >         <to
> uri="bean:spring.remote?method=springRemotingTest2(${body})"
> > />
> > >         <onCompletion onCompleteOnly="true" >
> > >             <process ref="post.processor" />
> > >             <to uri="jms:COMPLETED" />
> > >         </onCompletion>
> > >
> > >     </route>
> > >
> > >
> > >     <route autoStartup="true"   >
> > >         <from uri="direct:3.IN.SPRING.REMOTING" />
> > >         <transform>
> > >             <method bean="converter" method="toTestRequest"/>
> > >         </transform>
> > >         <to
> uri="bean:spring.remote?method=springRemotingTest3(${body})"
> > />
> > >         <onCompletion onCompleteOnly="true"  >
> > >             <process ref="post.processor" />
> > >             <to uri="jms:COMPLETED" />
> > >         </onCompletion>
> > >     </route>
> > >
> > > I want to retry independent from each other if one fails. The behavior
> > now
> > > is if one fails the three routes will be retried. I tried to do a
> custom
> > > error hander but the behavior was the same.
> > >
> > > ¿Any idea?
> > >
> > > Best regards
> > >
> > > Erwin
> > >
> >
> >
> >
> > --
> > *Christian Posta*
> > http://www.christianposta.com/blog
> > twitter: @christianposta
> >
>



-- 
*Christian Posta*
http://www.christianposta.com/blog
twitter: @christianposta

Re: Camel multicast and exception

Posted by Erwin Etchart <er...@gmail.com>.
Thanks for your response Christian,

Do you know if i try with "try catch" how can i do to define a  redelivery
police of this specific direct component?


Regards

Erwin




2013/9/26 Christian Posta <ch...@gmail.com>

> Take a look at try-catch block. Or try adding exception handlers to each
> individual "direct" route?
>
>
> On Thu, Sep 26, 2013 at 8:55 AM, Erwin Etchart <erwin.etchart@gmail.com
> >wrote:
>
> > Based on this example of a camel route
> >
> >     <aggregate id="ag.2" strategyRef="second.aggregator.strategy"
> > aggregationRepositoryRef="aggregator.container.2" completionSize="2"
> > completionTimeout="360000">
> >                             <correlationExpression>
> >                                 <header>aggregationKey</header>
> >                             </correlationExpression>
> >                             <multicast stopOnException="false"  >
> >                                 <to uri="direct:1.IN.SPRING.REMOTING" />
> >                                 <to uri="direct:2.IN.SPRING.REMOTING" />
> >                                 <to uri="direct:3.IN.SPRING.REMOTING" />
> >                             </multicast>
> >      </aggregate>
> >
> >
> >
> >     <route autoStartup="true"   >
> >         <from uri="direct:1.IN.SPRING.REMOTING" />
> >         <transform>
> >             <method bean="converter" method="toTestRequest"/>
> >         </transform>
> >         <to uri="bean:spring.remote?method=springRemotingTest(${body})"
>  />
> >         <onCompletion onCompleteOnly="true" >
> >             <process ref="post.processor" />
> >             <to uri="jms:COMPLETED" />
> >         </onCompletion>
> >
> >     </route>
> >
> >         <route autoStartup="true"  >
> >         <from uri="direct:2.IN.SPRING.REMOTING" />
> >         <transform>
> >             <method bean="converter" method="toTestRequest"/>
> >         </transform>
> >         <to uri="bean:spring.remote?method=springRemotingTest2(${body})"
> />
> >         <onCompletion onCompleteOnly="true" >
> >             <process ref="post.processor" />
> >             <to uri="jms:COMPLETED" />
> >         </onCompletion>
> >
> >     </route>
> >
> >
> >     <route autoStartup="true"   >
> >         <from uri="direct:3.IN.SPRING.REMOTING" />
> >         <transform>
> >             <method bean="converter" method="toTestRequest"/>
> >         </transform>
> >         <to uri="bean:spring.remote?method=springRemotingTest3(${body})"
> />
> >         <onCompletion onCompleteOnly="true"  >
> >             <process ref="post.processor" />
> >             <to uri="jms:COMPLETED" />
> >         </onCompletion>
> >     </route>
> >
> > I want to retry independent from each other if one fails. The behavior
> now
> > is if one fails the three routes will be retried. I tried to do a custom
> > error hander but the behavior was the same.
> >
> > ¿Any idea?
> >
> > Best regards
> >
> > Erwin
> >
>
>
>
> --
> *Christian Posta*
> http://www.christianposta.com/blog
> twitter: @christianposta
>

Re: Camel multicast and exception

Posted by Christian Posta <ch...@gmail.com>.
Take a look at try-catch block. Or try adding exception handlers to each
individual "direct" route?


On Thu, Sep 26, 2013 at 8:55 AM, Erwin Etchart <er...@gmail.com>wrote:

> Based on this example of a camel route
>
>     <aggregate id="ag.2" strategyRef="second.aggregator.strategy"
> aggregationRepositoryRef="aggregator.container.2" completionSize="2"
> completionTimeout="360000">
>                             <correlationExpression>
>                                 <header>aggregationKey</header>
>                             </correlationExpression>
>                             <multicast stopOnException="false"  >
>                                 <to uri="direct:1.IN.SPRING.REMOTING" />
>                                 <to uri="direct:2.IN.SPRING.REMOTING" />
>                                 <to uri="direct:3.IN.SPRING.REMOTING" />
>                             </multicast>
>      </aggregate>
>
>
>
>     <route autoStartup="true"   >
>         <from uri="direct:1.IN.SPRING.REMOTING" />
>         <transform>
>             <method bean="converter" method="toTestRequest"/>
>         </transform>
>         <to uri="bean:spring.remote?method=springRemotingTest(${body})"  />
>         <onCompletion onCompleteOnly="true" >
>             <process ref="post.processor" />
>             <to uri="jms:COMPLETED" />
>         </onCompletion>
>
>     </route>
>
>         <route autoStartup="true"  >
>         <from uri="direct:2.IN.SPRING.REMOTING" />
>         <transform>
>             <method bean="converter" method="toTestRequest"/>
>         </transform>
>         <to uri="bean:spring.remote?method=springRemotingTest2(${body})" />
>         <onCompletion onCompleteOnly="true" >
>             <process ref="post.processor" />
>             <to uri="jms:COMPLETED" />
>         </onCompletion>
>
>     </route>
>
>
>     <route autoStartup="true"   >
>         <from uri="direct:3.IN.SPRING.REMOTING" />
>         <transform>
>             <method bean="converter" method="toTestRequest"/>
>         </transform>
>         <to uri="bean:spring.remote?method=springRemotingTest3(${body})" />
>         <onCompletion onCompleteOnly="true"  >
>             <process ref="post.processor" />
>             <to uri="jms:COMPLETED" />
>         </onCompletion>
>     </route>
>
> I want to retry independent from each other if one fails. The behavior now
> is if one fails the three routes will be retried. I tried to do a custom
> error hander but the behavior was the same.
>
> ¿Any idea?
>
> Best regards
>
> Erwin
>



-- 
*Christian Posta*
http://www.christianposta.com/blog
twitter: @christianposta