Hey, I wonder if anyone has any info regarding this issue? It's possible (and maybe quite likely!) that I'm using the routeConfiguration/errorHandler incorrectly.
Thanks in advance. Best regards, Mikael pe 19. toukok. 2023 klo 15.24 Mikael Koskinen (mijap...@gmail.com) kirjoitti: > > Hi, > > I'm encountering a problem where route configuration's error handler > isn't run if the exception happens on a Kamelet. Here's the gist with > tries to show the issue: > https://gist.githubusercontent.com/mikoskinen/4e3e3a8efdf891890a2a46dfddae1d48/raw/09055bcdc1c2252a77a069fcebd07d6f727db555/camel-yaml-kamelet-errorhandling.yaml > > More details: > > > First, here's a (working) version with no Kamelets: > > - routeConfiguration: > errorHandler: > deadLetterChannel: > deadLetterUri: direct:errorHandler > redeliveryPolicy: > maximumRedeliveries: 0 > - route: > from: > uri: timer:timer > steps: > - setBody: > expression: > constant: > expression: Hello World > - marshal: > json: > library: jackson > prettyPrint: true > - to: > uri: https://webhook.sitessss/b7562774-4939-4e90-9337-5b9dd4d2ff1d > - route: > from: > uri: direct:errorHandler > steps: > - log: > message: Handling error > loggingLevel: WARN > description: Handle Error > > When run, this is what I see in the logs: > > 2023-05-19 15:14:13.783 WARN 20268 --- [- timer://timer] > testing.camel.yaml:25 : Handling error > 2023-05-19 15:14:14.626 WARN 20268 --- [- timer://timer] > testing.camel.yaml:25 : Handling error > > It is working as I expected. > > Now, with a just one change where HTTP component is changed to Kamelet > HTTP Sink and I'm getting completely different result. > > - routeConfiguration: > errorHandler: > deadLetterChannel: > deadLetterUri: direct:errorHandler > redeliveryPolicy: > maximumRedeliveries: 0 > - route: > from: > uri: timer:timer > steps: > - setBody: > expression: > constant: > expression: Hello World > - marshal: > json: > library: jackson > prettyPrint: true > - to: > uri: kamelet:http-sink > parameters: > url: > https://webhook.sitessss/b7562774-4939-4e90-9337-5b9dd4d2ff1d > - route: > from: > uri: direct:errorHandler > steps: > - log: > message: Handling error > loggingLevel: WARN > description: Handle Error > > Now when run I'm getting the stacktrace and there's no "Handling > error" to be found: > > 2023-05-19 15:20:22.084 INFO 17192 --- [ main] > el.impl.engine.AbstractCamelContext : Apache Camel 3.20.4 (tes > ting) started in 4s854ms (build:196ms init:3s906ms start:752ms JVM-uptime:8s) > 2023-05-19 15:20:23.165 ERROR 17192 --- [- timer://timer] > or.errorhandler.DefaultErrorHandler : Failed delivery for (Mes > sageId: B24BA7702CBB985-0000000000000000 on ExchangeId: > B24BA7702CBB985-0000000000000000). Exhausted after delivery atte > mpt: 1 caught: java.net.UnknownHostException: No such host is known > (webhook.sitessss) > > Message History > ------------------------------------------------------------------------------------------------------------------------ > --------------- > Source ID Processor > Elapsed (ms) > testing.camel.yaml:9 route1/route1 from[timer://timer] > 2701025406 > testing.camel.yaml:11 route1/setBody1 setBody[constant{Hello World}] > 2 > testing.camel.yaml:15 route1/marshal1 > marshal[org.apache.camel.model.dataformat.JsonDa > > A bug or do I have to configure something more to get the kamelet to > use the route's error handler? > > Best regards, > Mikael