Reputation: 717
I have a Camel route with split/aggregate:
from("seda:start")
.routeId("camelRoute")
.log("Request: ${body}")
.split()
.method(SplitService.class, "splitRequest")
.parallelProcessing()
.bean(SendToWorker.class, "sendToQ1(${body}, ${headers})")
.aggregate(header("corrID"),
new CustomAggregationStrategy()).completionSize(5)
.log("Aggregated ${body}")
.bean(SendToWorker.class, "sendToQ2(${body}, ${headers})")
.log("Response: ${body}");
The last log displays the result correctly. When I call it as
@Autowired
private ProducerTemplate producerTemplate;
[...]
Object o = producerTemplate.requestBodyAndHeaders("seda:start", request, headers)
I'm not able to get back the result from the Camel route. The returned o instance is the request object itself.
Does anyone have idea what can be wrong here?
Thanks for any help.
Upvotes: 0
Views: 2113
Reputation: 55760
You should use the splitter with agg strategy to do the split + aggregate, then its done in the same leg.
See the Split aggregate request/reply sample at:
Upvotes: 1
Reputation: 820
What about if you set the ExchangePattern to InOut just before sending it to your beans using:
...
.setExchangePattern(ExchangePattern.InOut)
.bean(...
Upvotes: 0