Examples of UseLatestAggregationStrategy


Examples of org.apache.camel.processor.aggregate.UseLatestAggregationStrategy

                // our route is aggregating from the direct queue and sending the response to the mock
                from("direct:start")
                    // aggregated by header id
                    // as we have not configured more on the aggregator it will default to aggregate the
                    // latest exchange only
                    .aggregate().header("id").aggregationStrategy(new UseLatestAggregationStrategy())
                    // wait for 0.5 seconds to aggregate
                    .completionTimeout(500L)
                    .to("mock:result");
                // END SNIPPET: e1
            }
View Full Code Here

Examples of org.apache.camel.processor.aggregate.UseLatestAggregationStrategy

    @Override
    protected JndiRegistry createRegistry() throws Exception {
        JndiRegistry jndi = super.createRegistry();
        jndi.bind("cool", cool);
        jndi.bind("agg", new UseLatestAggregationStrategy());
        return jndi;
    }
View Full Code Here

Examples of org.apache.camel.processor.aggregate.UseLatestAggregationStrategy

    }

    static class AggreagateRoute extends RouteBuilder {
        public void configure() throws Exception {
            from("seda:foo")
                .aggregate(constant("messageId"), new UseLatestAggregationStrategy()).completionTimeout(1000L).
                    to("seda:aggregated");
        }
View Full Code Here

Examples of org.apache.camel.processor.aggregate.UseLatestAggregationStrategy

    protected RouteBuilder createRouteBuilder() {
        return new RouteBuilder() {
            public void configure() {
                errorHandler(deadLetterChannel("mock:failed").maximumRedeliveries(0).handled(false));

                from("direct:seqential").split(body().tokenize(","), new UseLatestAggregationStrategy()).to("mock:result");

                from("direct:parallel").split(body().tokenize(","), new MyAggregationStrategy()).parallelProcessing().to("mock:result");

                from("direct:streaming").split(body().tokenize(",")).streaming().to("mock:result");
View Full Code Here

Examples of org.apache.camel.processor.aggregate.UseLatestAggregationStrategy

            @Override
            public void configure() throws Exception {
                // START SNIPPET: e1
                from("direct:start")
                    // aggregate every 3th second and disable the batch size so we set it to 0
                    .aggregate(header("id"), new UseLatestAggregationStrategy()).completionTimeout(3000).completionSize(0)
                    .to("mock:result");
                // END SNIPPET: e1
            }
        };
    }
View Full Code Here

Examples of org.apache.camel.processor.aggregate.UseLatestAggregationStrategy

                            if (exchange.getIn().getBody().equals("Damn")) {
                                throw new IllegalArgumentException();
                            }
                            return ExpressionBuilder.headerExpression("id").evaluate(exchange, type);
                        }
                    }, new UseLatestAggregationStrategy())
                    .completionTimeout(500)
                    .to("mock:result");
            }
        };
    }
View Full Code Here

Examples of org.apache.camel.processor.aggregate.UseLatestAggregationStrategy

        return new RouteBuilder() {
            @Override
            public void configure() throws Exception {
                // START SNIPPET: e1
                from("direct:start")
                    .aggregate(header("id"), new UseLatestAggregationStrategy())
                        // trigger completion every 5th second
                        .completionInterval(5000)
                    .to("mock:result");
                // END SNIPPET: e1
            }
View Full Code Here

Examples of org.apache.camel.processor.aggregate.UseLatestAggregationStrategy

            @Override
            public void configure() throws Exception {
                onException(IllegalArgumentException.class).handled(true).to("mock:handled");

                from("direct:start")
                    .aggregate(header("id"), new UseLatestAggregationStrategy()).completionTimeout(1000L)
                    .process(new Processor() {
                        public void process(Exchange exchange) throws Exception {
                            String body = exchange.getIn().getBody(String.class);
                            if ("Damn".equals(body)) {
                                throw new IllegalArgumentException("Damn");
View Full Code Here

Examples of org.apache.camel.processor.aggregate.UseLatestAggregationStrategy

    protected RouteBuilder createRouteBuilder() throws Exception {
        return new RouteBuilder() {
            public void configure() throws Exception {

                from("direct:start").
                    aggregate(header("id"), new UseLatestAggregationStrategy()).
                        completionTimeout(2000L).
                        bean(AggregatorBeanThrowExceptionTest.class, "fooDoesNotExistMethod").
                        to("log:foo");
            }
        };
View Full Code Here

Examples of org.apache.camel.processor.aggregate.UseLatestAggregationStrategy

            public void configure() {

                // START SNIPPET: ex
                // in this route we aggregate all from direct:state based on the header id cheese
                from("direct:start")
                    .aggregate(header("cheese"), new UseLatestAggregationStrategy()).completionTimeout(1000L)
                        .to("mock:result");

                from("seda:header").setHeader("visited", constant(true))
                    .aggregate(header("cheese"), new UseLatestAggregationStrategy()).completionTimeout(1000L)
                        .to("mock:result");

                // in this sample we aggregate using our own strategy with a completion predicate
                from("direct:predicate")
                    .aggregate(header("cheese"), new MyAggregationStrategy())
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.