You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Carlos Rodriguez Fernandez <ca...@gmail.com> on 2016/08/01 23:23:15 UTC

Understanding Error Handling on steps

Hi,

I'm trying to understand the error handling in Apache Camel. I have defined
a route to processes Kafka messages and I want the fetching to keep trying
forever, but to ignore exceptions from the processor. So I have this setup:

                from(notificationSystemInboundEndpoint)

                    .onException(Exception.class)

                        .maximumRedeliveries(-1)

                    .end()

                    .process(processor)

                    .onException(Exception.class)

                    .maximumRedeliveries(0)

                    .logStackTrace(true)

                    .handled(true);


I'm not sure this is correct. What would be the best way to do this?


Thank you,

Carlos.

Re: Understanding Error Handling on steps

Posted by Carlos Rodriguez Fernandez <ca...@gmail.com>.
If I understand correctly, the retries on the entry points to fetch the
message are defined by the entry point configurations, and when the Apache
Camel documentation mentions "redelivery" is talking about the delivery of
the messages that was already picked up by the entry point of the route
definition.

When the route is transactional, then the "redelivery" includes the
delivery and processing of the message all the way to the endpoint ("to"
definition).

So in my example, I won't need to do the onException after the "from".

 from(notificationSystemInboundEndpoint)

                    .process(processor)

                    .onException(Exception.class)

                    .maximumRedeliveries(0)

                    .logStackTrace(true)

                    .handled(true);
I kind of answer myself the question, (or I think I did). I didn't find a
clear explanation in the documentation of what the "redelivery" actually
meant in details. I think I figured it out after cloning the apache camel
project and looking/debugging the camel-kafka code. I gotta love
open-source.

Regards,
Carlos.

On Mon, Aug 1, 2016 at 4:23 PM Carlos Rodriguez Fernandez <
carlosrodrifernandez@gmail.com> wrote:

> Hi,
>
> I'm trying to understand the error handling in Apache Camel. I have
> defined a route to processes Kafka messages and I want the fetching to keep
> trying forever, but to ignore exceptions from the processor. So I have this
> setup:
>
>                 from(notificationSystemInboundEndpoint)
>
>                     .onException(Exception.class)
>
>                         .maximumRedeliveries(-1)
>
>                     .end()
>
>                     .process(processor)
>
>                     .onException(Exception.class)
>
>                     .maximumRedeliveries(0)
>
>                     .logStackTrace(true)
>
>                     .handled(true);
>
>
> I'm not sure this is correct. What would be the best way to do this?
>
>
> Thank you,
>
> Carlos.
>