I have two route A and B as below
from("some endpoint") //route A
.to("direct:x")
from("direct:x") //route B
.doTry()
.bean("somebean") //set Custom object PQR as message body
.doCatch()
.bean("some other bean") //log exception
.end()
Now I want to invoke route B once route A is complete (already done). Now how to get the response PQR object (only if route B succeeds) back from route B in route A?
It is supposed to do that automatically. If you chain another to
in route A after the to("direct:x")
, it will take the response from route B. You can try logging the body after the to("direct:x")
and check the result.