You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by murugess <ms...@gmail.com> on 2009/12/01 18:04:20 UTC

How to break from routing slip in camel on exception?

We are using camel binding component, with camel version 1.6.1.0, on
servicemix for our project. We are leveraging dynamic routing slip in camel
to process our request and are facing issues related to exception handling.
We have already defined global errorHandler which handles any exception that
occurs in any of the route. Now, whenever an exception occurs in any of the
endpoints within routing slip, exception handler is called as expected but
then once the exceptionHandler route is finished, control comes back to the
routingslip and rest of the endpoints get executed. No matter what we set on
exception route ( such as handled=false), all the endpoints in routing slip
eventually gets called. Here is the code snippet from RoutingSlip :


 for (String nextRecipient : recipients) {
            Endpoint<Exchange> endpoint = resolveEndpoint(exchange,
nextRecipient);
            Producer<Exchange> producer =
producerCache.getProducer(endpoint);
            Exchange ex = current.newInstance();

            updateRoutingSlip(current);
            copyOutToIn(ex, current);

            producer.process(ex);

            current = ex;
        }



    We don't see any provision to break from the above loop. Right now, the
work around we have adopted is to set EXCEPTION_HANDLED_PROPERTY on the
exchange so that the pipeline class does not delegate the request to the
actual endpoint. But there is still an overhead of pipeline being called for
all the endpoints configured within the routing slip.

    Any suggestions are welcome.
-- 
View this message in context: http://old.nabble.com/How-to-break-from-routing-slip-in-camel-on-exception--tp26594251p26594251.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: How to break from routing slip in camel on exception?

Posted by Jon Anstey <ja...@gmail.com>.
The 2.x line has tons of fixes in other areas too so yeah, it would be wise
to upgrade.

Cheers,
Jon

On Tue, Dec 1, 2009 at 4:04 PM, murugess <ms...@gmail.com> wrote:

>
> I think I am using the older version of camel ( 1.6.1.0) which does not
> have
> the fix for breaking the routingslip when exception is thrown by the
> recipient. I guess I need to upgrade to the latest version. Thanks for the
> quick fix.
>
>
>
> janstey wrote:
> >
> > FYI I've fixed this on the trunk here
> > http://svn.apache.org/viewvc?rev=885876&view=rev
> >
> > On Tue, Dec 1, 2009 at 3:39 PM, Jon Anstey <ja...@gmail.com> wrote:
> >
> >> Just took a look into this and found that setting the Exception on the
> >> Exchange doesn't really break you out of the routing slip as you want.
> >> I'm
> >> gonna fix that up on the trunk. But, throwing an Exception from a
> >> recipient
> >> does stop the routing slip. See this test case for an example
> >>
> http://svn.apache.org/repos/asf/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/routingslip/RoutingSlipWithExceptionTest.java
> >>
> >>
> >> On Tue, Dec 1, 2009 at 1:34 PM, murugess <ms...@gmail.com> wrote:
> >>
> >>>
> >>> We are using camel binding component, with camel version 1.6.1.0, on
> >>> servicemix for our project. We are leveraging dynamic routing slip in
> >>> camel
> >>> to process our request and are facing issues related to exception
> >>> handling.
> >>> We have already defined global errorHandler which handles any exception
> >>> that
> >>> occurs in any of the route. Now, whenever an exception occurs in any of
> >>> the
> >>> endpoints within routing slip, exception handler is called as expected
> >>> but
> >>> then once the exceptionHandler route is finished, control comes back to
> >>> the
> >>> routingslip and rest of the endpoints get executed. No matter what we
> >>> set
> >>> on
> >>> exception route ( such as handled=false), all the endpoints in routing
> >>> slip
> >>> eventually gets called. Here is the code snippet from RoutingSlip :
> >>>
> >>>
> >>>  for (String nextRecipient : recipients) {
> >>>            Endpoint<Exchange> endpoint = resolveEndpoint(exchange,
> >>> nextRecipient);
> >>>            Producer<Exchange> producer =
> >>> producerCache.getProducer(endpoint);
> >>>            Exchange ex = current.newInstance();
> >>>
> >>>            updateRoutingSlip(current);
> >>>            copyOutToIn(ex, current);
> >>>
> >>>            producer.process(ex);
> >>>
> >>>            current = ex;
> >>>        }
> >>>
> >>>
> >>>
> >>>    We don't see any provision to break from the above loop. Right now,
> >>> the
> >>> work around we have adopted is to set EXCEPTION_HANDLED_PROPERTY on the
> >>> exchange so that the pipeline class does not delegate the request to
> the
> >>> actual endpoint. But there is still an overhead of pipeline being
> called
> >>> for
> >>> all the endpoints configured within the routing slip.
> >>>
> >>>    Any suggestions are welcome.
> >>> --
> >>> View this message in context:
> >>>
> http://old.nabble.com/How-to-break-from-routing-slip-in-camel-on-exception--tp26594251p26594251.html
> >>> Sent from the Camel - Users mailing list archive at Nabble.com.
> >>>
> >>>
> >>
> >>
> >> --
> >> Cheers,
> >> Jon
> >>
> >> Camel in Action: http://manning.com/ibsen
> >> Blog: http://janstey.blogspot.com
> >>
> >
> >
> >
> > --
> > Cheers,
> > Jon
> >
> > Camel in Action: http://manning.com/ibsen
> > Blog: http://janstey.blogspot.com
> >
> >
>
> --
> View this message in context:
> http://old.nabble.com/How-to-break-from-routing-slip-in-camel-on-exception--tp26594251p26597746.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>


-- 
Cheers,
Jon

Camel in Action: http://manning.com/ibsen
Blog: http://janstey.blogspot.com

Re: How to break from routing slip in camel on exception?

Posted by murugess <ms...@gmail.com>.
I think I am using the older version of camel ( 1.6.1.0) which does not have
the fix for breaking the routingslip when exception is thrown by the
recipient. I guess I need to upgrade to the latest version. Thanks for the
quick fix.
    


janstey wrote:
> 
> FYI I've fixed this on the trunk here
> http://svn.apache.org/viewvc?rev=885876&view=rev
> 
> On Tue, Dec 1, 2009 at 3:39 PM, Jon Anstey <ja...@gmail.com> wrote:
> 
>> Just took a look into this and found that setting the Exception on the
>> Exchange doesn't really break you out of the routing slip as you want.
>> I'm
>> gonna fix that up on the trunk. But, throwing an Exception from a
>> recipient
>> does stop the routing slip. See this test case for an example
>> http://svn.apache.org/repos/asf/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/routingslip/RoutingSlipWithExceptionTest.java
>>
>>
>> On Tue, Dec 1, 2009 at 1:34 PM, murugess <ms...@gmail.com> wrote:
>>
>>>
>>> We are using camel binding component, with camel version 1.6.1.0, on
>>> servicemix for our project. We are leveraging dynamic routing slip in
>>> camel
>>> to process our request and are facing issues related to exception
>>> handling.
>>> We have already defined global errorHandler which handles any exception
>>> that
>>> occurs in any of the route. Now, whenever an exception occurs in any of
>>> the
>>> endpoints within routing slip, exception handler is called as expected
>>> but
>>> then once the exceptionHandler route is finished, control comes back to
>>> the
>>> routingslip and rest of the endpoints get executed. No matter what we
>>> set
>>> on
>>> exception route ( such as handled=false), all the endpoints in routing
>>> slip
>>> eventually gets called. Here is the code snippet from RoutingSlip :
>>>
>>>
>>>  for (String nextRecipient : recipients) {
>>>            Endpoint<Exchange> endpoint = resolveEndpoint(exchange,
>>> nextRecipient);
>>>            Producer<Exchange> producer =
>>> producerCache.getProducer(endpoint);
>>>            Exchange ex = current.newInstance();
>>>
>>>            updateRoutingSlip(current);
>>>            copyOutToIn(ex, current);
>>>
>>>            producer.process(ex);
>>>
>>>            current = ex;
>>>        }
>>>
>>>
>>>
>>>    We don't see any provision to break from the above loop. Right now,
>>> the
>>> work around we have adopted is to set EXCEPTION_HANDLED_PROPERTY on the
>>> exchange so that the pipeline class does not delegate the request to the
>>> actual endpoint. But there is still an overhead of pipeline being called
>>> for
>>> all the endpoints configured within the routing slip.
>>>
>>>    Any suggestions are welcome.
>>> --
>>> View this message in context:
>>> http://old.nabble.com/How-to-break-from-routing-slip-in-camel-on-exception--tp26594251p26594251.html
>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>
>>>
>>
>>
>> --
>> Cheers,
>> Jon
>>
>> Camel in Action: http://manning.com/ibsen
>> Blog: http://janstey.blogspot.com
>>
> 
> 
> 
> -- 
> Cheers,
> Jon
> 
> Camel in Action: http://manning.com/ibsen
> Blog: http://janstey.blogspot.com
> 
> 

-- 
View this message in context: http://old.nabble.com/How-to-break-from-routing-slip-in-camel-on-exception--tp26594251p26597746.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: How to break from routing slip in camel on exception?

Posted by Jon Anstey <ja...@gmail.com>.
FYI I've fixed this on the trunk here
http://svn.apache.org/viewvc?rev=885876&view=rev

On Tue, Dec 1, 2009 at 3:39 PM, Jon Anstey <ja...@gmail.com> wrote:

> Just took a look into this and found that setting the Exception on the
> Exchange doesn't really break you out of the routing slip as you want. I'm
> gonna fix that up on the trunk. But, throwing an Exception from a recipient
> does stop the routing slip. See this test case for an example
> http://svn.apache.org/repos/asf/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/routingslip/RoutingSlipWithExceptionTest.java
>
>
> On Tue, Dec 1, 2009 at 1:34 PM, murugess <ms...@gmail.com> wrote:
>
>>
>> We are using camel binding component, with camel version 1.6.1.0, on
>> servicemix for our project. We are leveraging dynamic routing slip in
>> camel
>> to process our request and are facing issues related to exception
>> handling.
>> We have already defined global errorHandler which handles any exception
>> that
>> occurs in any of the route. Now, whenever an exception occurs in any of
>> the
>> endpoints within routing slip, exception handler is called as expected but
>> then once the exceptionHandler route is finished, control comes back to
>> the
>> routingslip and rest of the endpoints get executed. No matter what we set
>> on
>> exception route ( such as handled=false), all the endpoints in routing
>> slip
>> eventually gets called. Here is the code snippet from RoutingSlip :
>>
>>
>>  for (String nextRecipient : recipients) {
>>            Endpoint<Exchange> endpoint = resolveEndpoint(exchange,
>> nextRecipient);
>>            Producer<Exchange> producer =
>> producerCache.getProducer(endpoint);
>>            Exchange ex = current.newInstance();
>>
>>            updateRoutingSlip(current);
>>            copyOutToIn(ex, current);
>>
>>            producer.process(ex);
>>
>>            current = ex;
>>        }
>>
>>
>>
>>    We don't see any provision to break from the above loop. Right now, the
>> work around we have adopted is to set EXCEPTION_HANDLED_PROPERTY on the
>> exchange so that the pipeline class does not delegate the request to the
>> actual endpoint. But there is still an overhead of pipeline being called
>> for
>> all the endpoints configured within the routing slip.
>>
>>    Any suggestions are welcome.
>> --
>> View this message in context:
>> http://old.nabble.com/How-to-break-from-routing-slip-in-camel-on-exception--tp26594251p26594251.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>
>>
>
>
> --
> Cheers,
> Jon
>
> Camel in Action: http://manning.com/ibsen
> Blog: http://janstey.blogspot.com
>



-- 
Cheers,
Jon

Camel in Action: http://manning.com/ibsen
Blog: http://janstey.blogspot.com

Re: How to break from routing slip in camel on exception?

Posted by Jon Anstey <ja...@gmail.com>.
Just took a look into this and found that setting the Exception on the
Exchange doesn't really break you out of the routing slip as you want. I'm
gonna fix that up on the trunk. But, throwing an Exception from a recipient
does stop the routing slip. See this test case for an example
http://svn.apache.org/repos/asf/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/routingslip/RoutingSlipWithExceptionTest.java

On Tue, Dec 1, 2009 at 1:34 PM, murugess <ms...@gmail.com> wrote:

>
> We are using camel binding component, with camel version 1.6.1.0, on
> servicemix for our project. We are leveraging dynamic routing slip in camel
> to process our request and are facing issues related to exception handling.
> We have already defined global errorHandler which handles any exception
> that
> occurs in any of the route. Now, whenever an exception occurs in any of the
> endpoints within routing slip, exception handler is called as expected but
> then once the exceptionHandler route is finished, control comes back to the
> routingslip and rest of the endpoints get executed. No matter what we set
> on
> exception route ( such as handled=false), all the endpoints in routing slip
> eventually gets called. Here is the code snippet from RoutingSlip :
>
>
>  for (String nextRecipient : recipients) {
>            Endpoint<Exchange> endpoint = resolveEndpoint(exchange,
> nextRecipient);
>            Producer<Exchange> producer =
> producerCache.getProducer(endpoint);
>            Exchange ex = current.newInstance();
>
>            updateRoutingSlip(current);
>            copyOutToIn(ex, current);
>
>            producer.process(ex);
>
>            current = ex;
>        }
>
>
>
>    We don't see any provision to break from the above loop. Right now, the
> work around we have adopted is to set EXCEPTION_HANDLED_PROPERTY on the
> exchange so that the pipeline class does not delegate the request to the
> actual endpoint. But there is still an overhead of pipeline being called
> for
> all the endpoints configured within the routing slip.
>
>    Any suggestions are welcome.
> --
> View this message in context:
> http://old.nabble.com/How-to-break-from-routing-slip-in-camel-on-exception--tp26594251p26594251.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>


-- 
Cheers,
Jon

Camel in Action: http://manning.com/ibsen
Blog: http://janstey.blogspot.com