Java 类org.apache.camel.processor.aggregate.GroupedExchangeAggregationStrategy 实例源码

项目:Camel    文件:AggregateGroupedExchangeBatchSizeTest.java   
@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
        }
    };
}
项目:Camel    文件:AggregateGroupedExchangeMultipleCorrelationTest.java   
@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
        }
    };
}
项目:Camel    文件:AggregateGroupedExchangeTest.java   
@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
        }
    };
}
项目:camelinaction2    文件:AggregateABCGroupTest.java   
@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");
        }
    };
}
项目:Camel    文件:MulticastGroupedExchangeExceptionTest.java   
@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");

        }
    };
}
项目:Camel    文件:AggregateGroupedExchangeSizePredicateTest.java   
@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();
        }
    };
}
项目:Camel    文件:AggregateGroupedExchangeCompletionSizeTest.java   
@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");
        }
    };
}
项目:Camel    文件:AggregateGroupedExchangeSizeTest.java   
@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();
        }
    };
}
项目:Camel    文件:DumpModelAsXmlAggregateRouteTest.java   
@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");
        }
    };
}
项目:Camel    文件:AggregationStrategies.java   
/**
 * Creates a {@link GroupedExchangeAggregationStrategy} aggregation strategy.
 */
public static AggregationStrategy groupedExchange() {
    return new GroupedExchangeAggregationStrategy();
}