You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by gilboy <jo...@gmail.com> on 2012/07/25 23:01:08 UTC

Exception handling in consumer of my custom component

Hi

Assume I have a route which goes:

*from("custom:component").process("").to("")..etc*

Lets also assume I have an exception/error/retry policy set on this route.
In my custom component consumer I need to invoke something like:
*
Exchange exchange = endpoint.createExchange();
exchange.getIn().setBody(socketMessage.getAsString());
getProcessor().process(exchange);
*

Now the call to process requires me to catch an exception. However, I want
exceptions to be handled via the exception handling policy defined in the
route. In other words, I don't want my consumer to have to implement
exception handling logic.

Just wondering how I can get round this

Thanks



--
View this message in context: http://camel.465427.n5.nabble.com/Exception-handling-in-consumer-of-my-custom-component-tp5716479.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Exception handling in consumer of my custom component

Posted by Christian Müller <ch...@gmail.com>.
In your consumer, you could call

getExceptionHandler().handleException(e);

Best,
Christian

On Wed, Jul 25, 2012 at 11:01 PM, gilboy <jo...@gmail.com> wrote:

> Hi
>
> Assume I have a route which goes:
>
> *from("custom:component").process("").to("")..etc*
>
> Lets also assume I have an exception/error/retry policy set on this route.
> In my custom component consumer I need to invoke something like:
> *
> Exchange exchange = endpoint.createExchange();
> exchange.getIn().setBody(socketMessage.getAsString());
> getProcessor().process(exchange);
> *
>
> Now the call to process requires me to catch an exception. However, I want
> exceptions to be handled via the exception handling policy defined in the
> route. In other words, I don't want my consumer to have to implement
> exception handling logic.
>
> Just wondering how I can get round this
>
> Thanks
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Exception-handling-in-consumer-of-my-custom-component-tp5716479.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>