You do not need onException if you have an errorHandler (see below).
If an error happens, Camel retries 5 times and if all fail then send a
message to deadLetterUri.
You might set another route in deadLetterUri.
- routeConfiguration:
errorHandler:
id: errorHandler-7273
deadLetterChannel:
deadLetterUri: amqp:dlq
id: deadLetterChannel-b9b4
redeliveryPolicy:
id: redeliveryPolicy-5119
maximumRedeliveries: 5
redeliveryDelay: '1000'
- route:
id: route-bbc3
from:
uri: kamelet:timer-source
id: from-d6c4
parameters:
repeatCount: 1
message: Route started
steps:
- to:
uri: http
id: to-3216
parameters:
httpUri: localhost:2000/test
httpMethod: GET
- log:
message: Route finished
id: log-75cd
On Tue, Aug 29, 2023 at 5:15 AM Zmrzlý, Daniel <[email protected]>
wrote:
> Hello Marat,
>
> I saw your example, but I still do not understand. Can you be more
> specific?
>
> This is my code from camel.yaml file:
>
> - routeConfiguration:
> onException:
> - onException:
> exception:
> - java.lang.Exception
> id: onException-6d2c
> steps:
> - log:
> message: Error while testing...
> id: log-062e
> errorHandler:
> id: errorHandler-7273
> deadLetterChannel:
> deadLetterUri: amqp:dlq
> id: deadLetterChannel-b9b4
> redeliveryPolicy:
> id: redeliveryPolicy-5119
> maximumRedeliveries: 5
> redeliveryDelay: '1000'
> - route:
> id: route-bbc3
> from:
> uri: kamelet:timer-source
> id: from-d6c4
> parameters:
> repeatCount: 1
> message: Route started
> steps:
> - to:
> uri: http
> id: to-3216
> parameters:
> httpUri: localhost:2000/test
> httpMethod: GET
> - log:
> message: Route finished
> id: log-75cd
>
> The http component throws an error and let's say I would like to retry the
> action five more times before I continue down the route. Can you rewrite a
> code or describe the procedure in detail?
>
> Thanks.
>
> Daniel
>
> pá 25. 8. 2023 v 17:20 odesílatel Marat Gubaidullin <
> [email protected]> napsal:
>
> > Hello Daniel,
> >
> > I would recommend adding route configuration with errorhandler.
> >
> > See example below:
> > https://github.com/apache/camel-karavan/discussions/871
> >
> > Marat
> >
> > On Fri, Aug 25, 2023 at 5:17 AM Zmrzlý, Daniel <[email protected]>
> > wrote:
> >
> > > Hi community,
> > >
> > > I am wondering if something like on error repeat loop component exists
> in
> > > Karavan. If not, is there any way to achieve it? Let's say inside the
> > > basic loop component is a log to the database and if sending fails I
> need
> > > to send the same log until the loop reaches max retries or the message
> > will
> > > be successfully sent.
> > >
> > > Best regards,
> > > Daniel
> > >
> >
>