Exception handling in consumer of my custom component

2012-07-25 Thread gilboy
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

2012-07-25 Thread Christian Müller
In your consumer, you could call

getExceptionHandler().handleException(e);

Best,
Christian

On Wed, Jul 25, 2012 at 11:01 PM, gilboy josephoto...@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.