You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by iocanel <ca...@upstreamsystems.com> on 2009/09/26 11:25:12 UTC

servicemix-camel and error handling

I am using servicemix 3.3 and camel 1.6.1.

I have the following flow:
[servicemix-jms:consumer]->[camel-jbi endpoint]->[custom endpoint].

I want when an error occurs in the custom endpoint (Exception, fail etc). to
be propagated back to my jms endpoint which is configured as transacted so
that my jms provider triggers its redelivery policy. However camel tries to
handler the error and it triggers its own redelivery policy.

How can I make my camel endpoint propagate all exceptions, errors and
failuers back to my jms consumer?




-- 
View this message in context: http://www.nabble.com/servicemix-camel-and-error-handling-tp25623679p25623679.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: servicemix-camel and error handling

Posted by iocanel <ca...@upstreamsystems.com>.
Gert,

The route starts with a jms consumer:

 <jms:consumer service="sns:jms-consumer"
        destinationName="${outbound-queue}"
        connectionFactory="#xaConnectionFactory"
        targetService="#targetService" 
        synchronous="true"
        transacted="xa"
        cacheLevel="3"
        marshaler="#consumerMarshaler"
        endpoint="jmsEndpoint"/>

The jms consumer is on an activemq queue. The target service is a pipeline
(transformer:xslt transformer, target service: camel-jbi endpoint).

The Camel Route is declared using DSL:
from("jbi:endpoint:http://my.namaspace.com/router/dynamic-router").throttler(THROTTLING_LIMIT).to("jbi:endpoint:http://my.namaspace.com/myservice/mycustomProviderEndpoint");

The problem lies when inside my custom provider endpoint I throw an
Exception or call fail() / error() on my Exchange.


As far as I know in a normal servicemix route the Exchange should return to
my consumer endpoint even as fail or error. When I use camel it seems that
no matter what the jms consumer gets a done back.




-- 
View this message in context: http://www.nabble.com/servicemix-camel-and-error-handling-tp25623679p25634774.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: servicemix-camel and error handling

Posted by Johan Edstrom <jo...@opennms.org>.
Could you do something like -

  from("jbi:service:http://a.com/b/camelFlowToIps").
                 to("jbi:service:urn:wsdl.a.ips.b.com/2010-01/PrimeIntegratedProductService?mep=in-out 
").errorHandler(deadLetterChannel("log:errors"))
                 .process(new IPSAckResponse());

And provide a second queue or file on the JBI side that you then re- 
polled?

> L.S.,
>
> Could you send me more details about the route and the MEPs you're
> using -- I'm guessing it's InOnly or RobustInOnly, right?  And are
> these fault messages you're trying to handle or exchanges that end in
> error?  Also, could you enable DEBUG logging and see what that says
> about the exception being handled.
>
>
> Regards,
>
> Gert Vanthienen
> ------------------------
> Open Source SOA: http://fusesource.com
> Blog: http://gertvanthienen.blogspot.com/
>
>
>
> 2009/9/26 iocanel <ca...@upstreamsystems.com>:
>>
>> Thanks Gert for the quick response.
>>
>> The solution you proposed disabled the camel error handler, however  
>> the
>> failure did not propagate back to the Jms Consumer. So when an  
>> error occurs
>> I can't have a Jms Redelivery.
>>
>> It seems that if I use errorHandler(noErrorHandler()); in my camel  
>> route
>> builder the error goes to a black whole instead of traveling back  
>> to the jms
>> consumer.
>>
>> Any ideas?
>> --
>> View this message in context: http://www.nabble.com/servicemix-camel-and-error-handling-tp25623679p25625927.html
>> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>>
>>

Johan Edstrom

joed@opennms.org

They that can give up essential liberty to purchase a little temporary  
safety, deserve neither liberty nor safety.

Benjamin Franklin, Historical Review of Pennsylvania, 1759






Re: servicemix-camel and error handling

Posted by Gert Vanthienen <ge...@gmail.com>.
L.S.,

Could you send me more details about the route and the MEPs you're
using -- I'm guessing it's InOnly or RobustInOnly, right?  And are
these fault messages you're trying to handle or exchanges that end in
error?  Also, could you enable DEBUG logging and see what that says
about the exception being handled.


Regards,

Gert Vanthienen
------------------------
Open Source SOA: http://fusesource.com
Blog: http://gertvanthienen.blogspot.com/



2009/9/26 iocanel <ca...@upstreamsystems.com>:
>
> Thanks Gert for the quick response.
>
> The solution you proposed disabled the camel error handler, however the
> failure did not propagate back to the Jms Consumer. So when an error occurs
> I can't have a Jms Redelivery.
>
> It seems that if I use errorHandler(noErrorHandler()); in my camel route
> builder the error goes to a black whole instead of traveling back to the jms
> consumer.
>
> Any ideas?
> --
> View this message in context: http://www.nabble.com/servicemix-camel-and-error-handling-tp25623679p25625927.html
> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>
>

Re: servicemix-camel and error handling

Posted by iocanel <ca...@upstreamsystems.com>.
Thanks Gert for the quick response.

The solution you proposed disabled the camel error handler, however the
failure did not propagate back to the Jms Consumer. So when an error occurs
I can't have a Jms Redelivery.

It seems that if I use errorHandler(noErrorHandler()); in my camel route
builder the error goes to a black whole instead of traveling back to the jms
consumer.

Any ideas?
-- 
View this message in context: http://www.nabble.com/servicemix-camel-and-error-handling-tp25623679p25625927.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: servicemix-camel and error handling

Posted by Gert Vanthienen <ge...@gmail.com>.
L.S.,

You can do this by disabling the error handler in your RouteBuilder's
configure() method by adding errorHandler(noErrorHandler());

Regards,

Gert Vanthienen
------------------------
Open Source SOA: http://fusesource.com
Blog: http://gertvanthienen.blogspot.com/



2009/9/26 iocanel <ca...@upstreamsystems.com>:
>
> I am using servicemix 3.3 and camel 1.6.1.
>
> I have the following flow:
> [servicemix-jms:consumer]->[camel-jbi endpoint]->[custom endpoint].
>
> I want when an error occurs in the custom endpoint (Exception, fail etc). to
> be propagated back to my jms endpoint which is configured as transacted so
> that my jms provider triggers its redelivery policy. However camel tries to
> handler the error and it triggers its own redelivery policy.
>
> How can I make my camel endpoint propagate all exceptions, errors and
> failuers back to my jms consumer?
>
>
>
>
> --
> View this message in context: http://www.nabble.com/servicemix-camel-and-error-handling-tp25623679p25623679.html
> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>
>