When configuring my route builder, I use the following pattern in the configure() method:
onException(InternalException.class)
.log("ITI-43 route: caught InternalException: ${exception.message}")
.handled(true)
.maximumRedeliveries(2)
.delay(500)
.bean(Iti43ResponseConverter.class)
.stop();
onException(Exception.class)
.log("ITI-43 route: caught Exception: ${exception.message}")
.handled(true)
.bean(Iti43ResponseConverter.class)
.stop();
from("xds-iti43:xds/iti43")
.routeId("xds-iti43-consumer")
.bean(Iti43QueryValidator.class)
.bean(Iti43QueryConverter.class)
.bean(RetrieveDocumentsProcessor.class)
.bean(Iti43ResponseConverter.class)
.process(iti43ResponseValidator());
I declare exception handling before the actual route. It works well for me, you could try it.