I need some help with update of exchange property in Apache Camel.
Use case:
I have route which gets some Ids from API endpoint, after that i need to get info for every id from another endpoint.
I need to keep responses somewhere in order to create some JSON array later.
Can someone give me some working route with similar use case or just point me in right direction?
sample route
from("direct:getIds") .setProperty("ValueToUpdate").constant("")
.to("endpontWhichReturns ids")
.split().jsonpath("$.Data") .log("${property.xrefCode}")
.toD("getInfoById) .log("${body}")
.choice() .when(header("CamelHttpResponseCode").isEqualTo("200"))
.setProperty("body").body()
.setProperty("updateBody",method("PrepareUpdate","prepare"))
.aggregate(property("ValueToUpdate"), new Aggreagation())
.to("direct:someEndpoint") .end() .to("mock:nestdo11");
2
Answers
You can use Simple.
You can use setProperty on the Exchange API.
Hope this simple route will help you: