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

Popular posts from this blog

java - Plugin org.apache.maven.plugins:maven-install-plugin:2.4 or one of its dependencies could not be resolved -

Round ImageView Android -

How can I utilize Yahoo Weather API in android -