I am trying to use an onException clause within my route that also has an aggregator in it. I was expecting that whenever an exception is thrown within the aggregate() method of my aggregator, the OnException clause should catch it, handle it and redeliver it. However, that doesnt seem to be happening. Can anyone please suggest where I am going wrong.
from("jms:queue:start?concurrentConsumers=10").routeId("testRoute")
.onException(Exception.class).log("Exception caught").process(new Processor() {
@Override
public void process(Exchange exchange) throws Exception {
logger.debug("****Exception caught***");
}
})
.handled(true).maximumRedeliveries(-1).end()
.transacted()
.aggregate(header("correlationHeader"), new CustomAggregator())
.completionSize(50).
to("jms:queue:end");
where CustomAggregator is my aggregator and within its aggregate method I am throwing an Exception to test my exception handling.
Any help or suggestion appreciated.