I want to use apache camel to call an external REST service multiple times. After all calls complete, I want to aggregate the results. I know I can perform one call with camel as defined in camel FAQ like so:
protected RouteBuilder createRouteBuilder() throws Exception {
return new RouteBuilder() {
@Override
public void configure() throws Exception {
rest("/say")
.get("/sample").to("direct:hello")
.toD("placeIwantToCall")
}
};
}
But I do not know how I can call it multiple times.
Goal: The number of times I need to call this external rest service differs over time. ( Sometimes it is 1, sometimes it is 10, etc. I will however, know this number as I can read it from the incoming header ) Once all calls complete, I want to aggregate all of the results into one big result. How can I do this in Apache Camel? ( The solution from this question : Apache camel to aggregate multiple REST service responses : can probably be used here, but I am having a hard time wrapping my head around how I'd use it.