Hello all,

OnException block , the TechnicalException will be caught, this
exception could come

from Route A or Route B , my question is , Is it possible for on Exception block

to figure out where the TechnicalException is originated from ? for
example from which Route or from which Endpoint?

I tried to use exchange.getProperty(Exchange.FAILURE_ENDPOINT) or
exchange.getProperty(Exchange.FAILURE_ROUTE_ID)

but they both print out null value

Any hints or suggestions are more than welcome!




onException(TechnicalException.class)
              .log(LoggingLevel.ERROR, "TechnicalException caught globally  ")
              .redeliveryDelay(3000)
              .maximumRedeliveries(3)
              //Exchange.FAILURE_ROUTE_ID
              .onRedelivery(exchange -> {
               LOG.info("onRedelivery {} , failed endpoint id {}
exception type {}",
exchange.getIn().getHeader(Exchange.REDELIVERY_COUNTER)
         ,exchange.getProperty(Exchange.FAILURE_ENDPOINT) ,
exchange.getProperty(Exchange.EXCEPTION_CAUGHT).getClass());
              })
      .handled(true)
              .to("activemq:queue:mydeadletterqueue")
              .log(LoggingLevel.ERROR, "technical exception send to
mydeadletterqueue")
              .end();


route A

route B

Reply via email to