Package org.apache.camel.processor

Examples of org.apache.camel.processor.BodyInAggregatingStrategy


                from("direct:start")
                    // aggregate all exchanges correlated by the id header.
                    // Aggregate them using the BodyInAggregatingStrategy strategy which
                    // and after 3 seconds of inactivity them timeout and complete the aggregation
                    // and send it to mock:aggregated
                    .aggregate(header("id"), new BodyInAggregatingStrategy()).completionTimeout(3000)
                        .to("mock:aggregated");
                // END SNIPPET: e1
            }
        };
    }
View Full Code Here


        return new RouteBuilder() {
            @Override
            public void configure() throws Exception {
                from("seda:start")
                    .bean(TestBean.class)
                    .aggregate(constant("true"), new BodyInAggregatingStrategy())
                        .aggregationRepository(myRepo)
                        .completionSize(2)
                        .to("mock:result");
            }
        };
View Full Code Here

    protected RouteBuilder createRouteBuilder() throws Exception {
        return new RouteBuilder() {
            @Override
            public void configure() throws Exception {
                from("direct:start")
                    .aggregate(header("id"), new BodyInAggregatingStrategy())
                            .completionPredicate(body().contains("END")).completionTimeout(20000)
                        .to("mock:aggregated");
            }
        };
    }
View Full Code Here

    public void testAggregateEagerCheckCompletion() throws Exception {
        context.addRoutes(new RouteBuilder() {
            @Override
            public void configure() throws Exception {
                from("direct:start")
                    .aggregate(header("id"), new BodyInAggregatingStrategy())
                        .completionPredicate(body().isEqualTo("END")).eagerCheckCompletion()
                        .to("mock:result");
            }
        });
        context.start();
View Full Code Here

    public void testAggregateNotEagerCheckCompletion() throws Exception {
        context.addRoutes(new RouteBuilder() {
            @Override
            public void configure() throws Exception {
                from("direct:start")
                    .aggregate(header("id"), new BodyInAggregatingStrategy())
                        .completionPredicate(body().isEqualTo("A+B+END"))
                        .to("mock:result");
            }
        });
        context.start();
View Full Code Here

        return new RouteBuilder() {
            @Override
            public void configure() throws Exception {
                // START SNIPPET: e1
                from("direct:start")                   
                    .aggregate(body(), new BodyInAggregatingStrategy()).completionFromBatchConsumer()
                    .to("mock:result");
                // END SNIPPET: e1
            }
        };
    }
View Full Code Here

        mock.expectedBodiesReceived("A+B");
        mock.expectedPropertyReceived(Exchange.AGGREGATED_COMPLETED_BY, "timeout");

        Processor done = new SendProcessor(context.getEndpoint("mock:result"));
        Expression corr = header("id");
        AggregationStrategy as = new BodyInAggregatingStrategy();

        AggregateProcessor ap = new AggregateProcessor(context, done, corr, as, executorService, true);
        // start with a high timeout so no completes before we stop
        ap.setCompletionTimeout(2000);
        ap.start();
View Full Code Here

        mock.expectedBodiesReceived("A+B");
        mock.expectedPropertyReceived(Exchange.AGGREGATED_COMPLETED_BY, "timeout");

        Processor done = new SendProcessor(context.getEndpoint("mock:result"));
        Expression corr = header("id");
        AggregationStrategy as = new BodyInAggregatingStrategy();

        AggregateProcessor ap = new AggregateProcessor(context, done, corr, as, executorService, true);
        // start with a high timeout so no completes before we stop
        ap.setCompletionTimeoutExpression(header("myTimeout"));
        ap.start();
View Full Code Here

        mock.expectedBodiesReceived("C+D", "A+B");
        mock.expectedPropertyReceived(Exchange.AGGREGATED_COMPLETED_BY, "timeout");

        Processor done = new SendProcessor(context.getEndpoint("mock:result"));
        Expression corr = header("id");
        AggregationStrategy as = new BodyInAggregatingStrategy();

        AggregateProcessor ap = new AggregateProcessor(context, done, corr, as, executorService, true);
        // start with a high timeout so no completes before we stop
        ap.setCompletionTimeoutExpression(header("myTimeout"));
        ap.start();
View Full Code Here

    protected RouteBuilder createRouteBuilder() throws Exception {
        return new RouteBuilder() {
            @Override
            public void configure() throws Exception {
                from("direct:start")
                    .aggregate(header("aggregateGroup"), new BodyInAggregatingStrategy()).completionFromBatchConsumer()
                        .to("log:aggregated")
                        .to("mock:result");
            }
        };
    }
View Full Code Here

TOP

Related Classes of org.apache.camel.processor.BodyInAggregatingStrategy

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.