@Override protected RouteBuilder createRouteBuilder() throws Exception { return new RouteBuilder() { public void configure() throws Exception { // START SNIPPET: e1 // our route is aggregating from the direct queue and sending the response to the mock from("direct:start") .log("Aggregator received ${body}") // aggregated all use same expression and group the exchanges so we get one single exchange containing all the others .aggregate(new GroupedExchangeAggregationStrategy()).constant(true).completionSize(2) // wait for 0.5 seconds to aggregate .completionTimeout(500L) .to("mock:result"); // END SNIPPET: e1 } }; }
@Override protected RouteBuilder createRouteBuilder() throws Exception { return new RouteBuilder() { public void configure() throws Exception { // START SNIPPET: e1 // our route is aggregating from the direct queue and sending the response to the mock from("direct:start") // aggregate all using the foo header and group the exchanges so we get one single exchange containing all the others .aggregate(header("foo"), new GroupedExchangeAggregationStrategy()) // wait for 1 seconds to aggregate .completionTimeout(1000L) .to("mock:result"); // END SNIPPET: e1 } }; }
@Override protected RouteBuilder createRouteBuilder() throws Exception { return new RouteBuilder() { public void configure() throws Exception { // START SNIPPET: e1 // our route is aggregating from the direct queue and sending the response to the mock from("direct:start") // aggregate all using same expression and group the exchanges so we get one single exchange containing all the others .aggregate(new GroupedExchangeAggregationStrategy()).constant(true) // wait for 0.5 seconds to aggregate .completionTimeout(500L) .to("mock:result"); // END SNIPPET: e1 } }; }
@Override protected RouteBuilder createRouteBuilder() throws Exception { return new RouteBuilder() { @Override public void configure() throws Exception { from("direct:start") // do a little logging .log("Sending ${body} with correlation key ${header.myId}") // aggregate based on header correlation key .aggregate(header("myId"), new GroupedExchangeAggregationStrategy()).completionSize(3) // do a little logging for the published message .log("Sending out ${body}") // and send it to the mock .to("mock:result"); } }; }
@Override protected RouteBuilder createRouteBuilder() throws Exception { return new RouteBuilder() { @Override public void configure() throws Exception { from("direct:start") .multicast(new GroupedExchangeAggregationStrategy()) .to("mock:endpointA", "mock:endpointB") .end() .to("mock:result"); } }; }
@Override protected RouteBuilder createRouteBuilder() throws Exception { return new RouteBuilder() { public void configure() throws Exception { from("direct:start") // must use eagerCheckCompletion so we can check the groupSize header on the incoming exchange .aggregate(new GroupedExchangeAggregationStrategy()).constant(true).eagerCheckCompletion().completionSize(header("groupSize")) .to("mock:result") .end(); } }; }
@Override protected RouteBuilder createRouteBuilder() throws Exception { return new RouteBuilder() { public void configure() throws Exception { from("direct:start") .aggregate(new GroupedExchangeAggregationStrategy()).constant(true).completionSize(3) .to("mock:result"); } }; }
@Override protected RouteBuilder createRouteBuilder() throws Exception { return new RouteBuilder() { public void configure() throws Exception { from("direct:start") .aggregate(new GroupedExchangeAggregationStrategy()).constant(true).completionSize(3) .to("mock:result") .end(); } }; }
@Override protected RouteBuilder createRouteBuilder() throws Exception { return new RouteBuilder() { @Override public void configure() throws Exception { from("direct:start").routeId("myRoute") .to("log:input") .aggregate(header("userId"), new GroupedExchangeAggregationStrategy()).completionSize(3) .to("mock:aggregate") .end() .to("mock:result"); } }; }
/** * Creates a {@link GroupedExchangeAggregationStrategy} aggregation strategy. */ public static AggregationStrategy groupedExchange() { return new GroupedExchangeAggregationStrategy(); }