I have a complex route which is as below (partly):
.when(header("KEY_1").isNull())
.choice()
.when(header("KEY_2").isNull())
.split().method(SplitExample.class, "invokeSplitter").streaming().parallelProcessing().executorService(threadPoolExecutor) // first split
.policy(requires_new)
.bean(SplitExample.class, "enrich")
.bean(persister,"populateRecordAndXRef")
.bean(initializer, "initialize")
.bean(validator, "validateInMsg")
.bean(suppressResolver, "resolve")
.choice()
.when(header("KEY_3").isNull())
.bean(MsgConverter.class,"doInvoke" ) // #1 property or header set here
.split(body()) // second split
.bean(validator, "validateOutMsg")
.to(toURI.toArray(new String[ toURI.size()]))
.process(new Processor() {
@Override
public void process(Exchange exchange) throws Exception {
System.out.println(exchange.getException()); // #2 queue server is shut down here so that transaction failure occurs
}
})
.endChoice() //end when
.end() //end choice
.end() //end policy
.end() //end split
.endChoice() //end when
I have also defined following exception policy:
onException(JMSException.class)
.handled(true)
.process(new QueueOperationFailureProcessor()); // #3 property or header should be accessible here
Now, my intention is to set a bean as Exchange property ("RECOVERY_DETAIL") in MsgConverter (#1)
and retrieve the same bean in QueueOperationFailureProcessor (#3)
.
By debugging, I can see the property ("RECOVERY_DETAIL") in the in-line processor (#2)
. On JMSException, when my exception policy kicks in, I would like to retrieve the property ("RECOVERY_DETAIL") in QueueOperationFailureProcessor (#3)
.
But as it happens - the Exchange available in QueueOperationFailureProcessor (#3)
is different from the one that is available at in-line processor (#2)
and the property ("RECOVERY_DETAIL") is no where to be found.
Please help me out.
P.S. My camel version is 2.16.0 and I may not able to use any solution which requires version up-gradation.
exchangeId
property to trace where it has come from. – Tradesman