java - Use different aggregation strategy in camel depending on some header -
what correct way use different aggregation strategy in camel depending on header? following way fine or there other cleaner approach this?
from("direct:start") .choice() .when(header("foo").equalto("bar")) .aggregate(header("id"), new bodyinaggregatingstrategy()).completiontimeout(3000).endchoice() .when(header("foo").equalto("foobar")) .aggregate(header("id"), new bodyoutaggregatingstrategy()).completiontimeout(3000) .to("mock:aggregated");
you need implement own compound aggregation strategy, , aggregate accordingly header value, eg camel pov there 1 strategy , calls aggregate method. figure out depending on header value. can delegate aggregation strategy on behalf.
then not need content based router.
Comments
Post a Comment