camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <>
Subject Re: File2 endpoint issue
Date Wed, 18 Apr 2012 06:26:33 GMT
On Wed, Apr 18, 2012 at 12:02 AM, brbornia <> wrote:
> Hey guys,
> Forget my last post, I´m feeling stupid right now... The method begin must
> return true to continue with the polling. After I fixed that, the polling
> strategy started working as expected.

Yes read the javadoc of the methods. Also for the commit method as well.

> Now, I have another question related to that. I have set in my context an
> error handler like this:
> <onException>
>        <exception>java.lang.Exception</exception>
>        <some_stuff_here/>
>        <to uri="activemq:topic:error"/>
> </onException>
> But it´s not capturing the exception thrown in my
> PollingConsumerPollStrategy, even returning true on rollback method.
> Actually, I did not undertand completetly what the return of rollback means.
> Anyway, is that the expected behavior or I am missing something again? Any
> suggestions on how I could handle the exception like the above onException
> clause? I really would like to use the camel benefits to handle my exception
> instead of simple java code.

Yes that is the expected behavior. As said before Camel error handling
in the routes (eg onException, errorHandler) only applies when
*routing* messages.

At this point of stage you do not yet have a message to route. Error
handling at this level is *component* specific, how they deal with
Some components like JMS will be able to retry and failover etc.
Others take other actions etc. And in your case there is not even a
failure from the file component, there was just no files to poll.

However since you have this hook with the strategy, You can create a
Camel message that has a pre set exception and send that to a Camel
route  that triggers the error handling. You can use ProducerTemplate
to send a message for example.

> Thanks again,
> Bruno.
> --
> View this message in context:
> Sent from the Camel - Users mailing list archive at

Claus Ibsen
CamelOne 2012 Conference, May 15-16, 2012:
Twitter: davsclaus, fusenews
Author of Camel in Action:

View raw message