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/29 18:49:17 UTC

Exception handling in consumer for a custom endpoint

Hi

I have a custom endpoint/component. The consumer is a scheduledpollconsumer.
I had a quick question on the behaviour of the *doStart() *and *poll()
*methods which I implement in my consumer.

Basically, the implementation of these 2 methods which I have provided in my
consumer do quite a bit of processing. Hence, I was trying to confirm how
camel will behave if an exception occurs in my doStart() or poll() methods
which I do not handle. 

In other words, I am trying to understand how the core camel code will
behave if an unhandled exception is passed back from either my doStart() or
poll() method?

Thanks
Joe 



--
View this message in context: http://camel.465427.n5.nabble.com/Exception-handling-in-consumer-for-a-custom-endpoint-tp5716588.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Exception handling in consumer for a custom endpoint

Posted by gilboy <jo...@gmail.com>.
Hi Christian

Thanks for the response. 

As rgds #2, I took a look at the ScheduledPollConsumer code like you said. 

If an exception occurs while calling the poll() method it appears to invoke
PollingConsumerPollStrategy.rollback() to determine if we should call the
invoke method again. However, in the rollback() method it does appear to use
the retryCounter to determine if we should continue polling

Thanks
Joe



--
View this message in context: http://camel.465427.n5.nabble.com/Exception-handling-in-consumer-for-a-custom-endpoint-tp5716588p5716749.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Exception handling in consumer for a custom endpoint

Posted by Christian Müller <ch...@gmail.com>.
If your doStart() method throws an exception, the application will not
start [1].
If your poll() method throws an exception, Camel will retry until the retry
count is exceeded. Than the route will stop polling [2].

[1]
https://svn.apache.org/repos/asf/camel/trunk/camel-core/src/main/java/org/apache/camel/main/Main.java
[2]
https://svn.apache.org/repos/asf/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/ScheduledPollConsumer.java

Best,
Christian

On Sun, Jul 29, 2012 at 6:49 PM, gilboy <jo...@gmail.com> wrote:

> Hi
>
> I have a custom endpoint/component. The consumer is a
> scheduledpollconsumer.
> I had a quick question on the behaviour of the *doStart() *and *poll()
> *methods which I implement in my consumer.
>
> Basically, the implementation of these 2 methods which I have provided in
> my
> consumer do quite a bit of processing. Hence, I was trying to confirm how
> camel will behave if an exception occurs in my doStart() or poll() methods
> which I do not handle.
>
> In other words, I am trying to understand how the core camel code will
> behave if an unhandled exception is passed back from either my doStart() or
> poll() method?
>
> Thanks
> Joe
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Exception-handling-in-consumer-for-a-custom-endpoint-tp5716588.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>