I'm fairly new to Apache Camel and have a couple questions. I want my route to do the following:
- load a list of lists in
LoadSomeThingsProcessor - split twice so I can handle each item in the inner list
- filter out some things I don't need
- join all remaining exchanges from the inner split
- then eventually join again (back to one exchange)
My route that looks something like the following:
from("direct:myRoute")
.process(new LoadSomeThingsProcessor())
.split(body())
.streaming()
.process(new SomeProcessor())
.split(body())
.streaming()
.filter(new SomeFilter())
.aggregate(header("myHeader", new MyAggregationStrategy())
.completionPredicate(new MyCompletionPredicate())
// more processors
// aggregate again (should just be one exchange after this point
// more processors
.to("direct:someOtherRoute");
MyCompletionPredicate's matches method is just:
return exchange.getIn().getProperty("CamelSplitComplete", Boolean.class);
I want to ensure that ALL exchanges in each split are aggregated together before I continue.
My questions are:
- The CamelSplitComplete header is somehow never true. What could cause this?
- Is trying to aggregate inside a nested split going to cause any issues?
- What happens if the last exchange (the one that is supposed to have CamelSplitComplete = true is filtered out? How can I know that I have aggregated all my exchanges together?
- Is this even the right way to approach this problem? If no, what else should I consider?
FYI my aggregation strategy just takes the bodies of the new exchange and adds them to the body of the old exchange.
Many thanks in advance.