Package org.apache.camel.processor

Examples of org.apache.camel.processor.Aggregator


    @Override
    public void addRoutes(RouteContext routeContext, Collection<Route> routes) throws Exception {
        Endpoint from = routeContext.getEndpoint();
        final Processor processor = routeContext.createProcessor(this);
        final Aggregator service = new Aggregator(from, processor, getExpression()
            .createExpression(routeContext), aggregationStrategy);

        Route route = new Route<Exchange>(from, service) {
            @Override
            public String toString() {
View Full Code Here


    }

    @SuppressWarnings("unchecked")
    @Override
    public void addRoutes(RouteContext routeContext, Collection<Route> routes) throws Exception {
        final Aggregator aggregator = createAggregator(routeContext);
        doAddRoute(routeContext, routes, aggregator);
    }
View Full Code Here

        routes.add(route);
    }
    @Override
    public Processor createProcessor(RouteContext routeContext) throws Exception {
        final Aggregator aggregator = createAggregator(routeContext);
       
        doAddRoute(routeContext, routeContext.getCamelContext().getRoutes(), aggregator);
        routeContext.setIsRouteAdded(true);
        return aggregator;
    }
View Full Code Here

    protected Aggregator createAggregator(RouteContext routeContext) throws Exception {
        Endpoint from = routeContext.getEndpoint();
        final Processor processor = routeContext.createProcessor(this);

        final Aggregator aggregator;
        if (aggregationCollection != null) {
            // create the aggregator using the collection
            // pre configure the collection if its expression and strategy is not set, then
            // use the ones that is pre configured with this type
            if (aggregationCollection.getCorrelationExpression() == null) {
                aggregationCollection.setCorrelationExpression(getExpression());
            }
            if (aggregationCollection.getAggregationStrategy() == null) {
                AggregationStrategy strategy = createAggregationStrategy(routeContext);
                aggregationCollection.setAggregationStrategy(strategy);
            }
            aggregator = new Aggregator(from, processor, aggregationCollection);
        } else {
            // create the aggregator using a default collection
            AggregationStrategy strategy = createAggregationStrategy(routeContext);

            Expression aggregateExpression = getExpression().createExpression(routeContext);

            Predicate predicate = null;
            if (getCompletedPredicate() != null) {
                predicate = getCompletedPredicate().createPredicate(routeContext);
            }
            if (predicate != null) {
                aggregator = new Aggregator(from, processor, aggregateExpression, strategy, predicate);
            } else {
                aggregator = new Aggregator(from, processor, aggregateExpression, strategy);
            }
        }
       
        if (batchSize != null) {
            aggregator.setBatchSize(batchSize);
        }
       
        if (batchTimeout != null) {
            aggregator.setBatchTimeout(batchTimeout);
        }

        if (outBatchSize != null) {
            aggregator.setOutBatchSize(outBatchSize);
        }
       
        return aggregator;
    }
View Full Code Here

    }

    protected Aggregator createAggregator(RouteContext routeContext) throws Exception {
        final Processor processor = routeContext.createProcessor(this);

        final Aggregator aggregator;
        if (getAggregationCollection() == null) {
            setAggregationCollection(createAggregationCollection(routeContext));
        }
       
        if (aggregationCollection != null) {
            // create the aggregator using the collection
            // pre configure the collection if its expression and strategy is not set, then
            // use the ones that is pre configured with this type
            if (aggregationCollection.getCorrelationExpression() == null) {
                aggregationCollection.setCorrelationExpression(getExpression());
            }
            if (aggregationCollection.getAggregationStrategy() == null) {
                AggregationStrategy strategy = createAggregationStrategy(routeContext);
                aggregationCollection.setAggregationStrategy(strategy);
            }
            aggregator = new Aggregator(processor, aggregationCollection);
        } else {
            // create the aggregator using a default collection
            AggregationStrategy strategy = createAggregationStrategy(routeContext);

            Expression aggregateExpression = getExpression().createExpression(routeContext);

            Predicate predicate = null;
            if (getCompletedPredicate() != null) {
                predicate = getCompletedPredicate().createPredicate(routeContext);
            }
            if (predicate != null) {
                aggregator = new Aggregator(processor, aggregateExpression, strategy, predicate);
            } else {
                aggregator = new Aggregator(processor, aggregateExpression, strategy);
            }
        }
       
        if (batchSize != null) {
            aggregator.setBatchSize(batchSize);
        }
       
        if (batchTimeout != null) {
            aggregator.setBatchTimeout(batchTimeout);
        }

        if (outBatchSize != null) {
            aggregator.setOutBatchSize(outBatchSize);
        }
       
        return aggregator;
    }
View Full Code Here

    @Override
    public void addRoutes(RouteContext routeContext, Collection<Route> routes) throws Exception {
        Endpoint from = routeContext.getEndpoint();
        final Processor processor = routeContext.createProcessor(this);

        final Aggregator service;
        if (aggregationCollection != null) {
            service = new Aggregator(from, processor, aggregationCollection);
        } else {
            AggregationStrategy strategy = getAggregationStrategy();
            if (strategy == null && strategyRef != null) {
                strategy = routeContext.lookup(strategyRef, AggregationStrategy.class);
            }
            if (strategy == null) {
                strategy = new UseLatestAggregationStrategy();
            }
            Expression aggregateExpression = getExpression().createExpression(routeContext);

            Predicate predicate = null;
            if (completedPredicate != null) {
                predicate = completedPredicate.createPredicate(routeContext);
            }
            if (predicate != null) {
                service = new Aggregator(from, processor, aggregateExpression, strategy, predicate);
            } else {
                service = new Aggregator(from, processor, aggregateExpression, strategy);
            }
        }

        if (batchSize != null) {
            service.setBatchSize(batchSize);
        }
        if (batchTimeout != null) {
            service.setBatchTimeout(batchTimeout);
        }

        Route route = new Route<Exchange>(from, service) {
            @Override
            public String toString() {
View Full Code Here

    }
   
    protected Aggregator createAggregator(RouteContext routeContext) throws Exception {
        final Processor processor = routeContext.createProcessor(this);

        final Aggregator aggregator;
        if (getAggregationCollection() == null) {
            setAggregationCollection(createAggregationCollection(routeContext));
        }
       
        if (aggregationCollection != null) {
            // create the aggregator using the collection
            // pre configure the collection if its expression and strategy is not set, then
            // use the ones that is pre configured with this type
            if (aggregationCollection.getCorrelationExpression() == null) {
                aggregationCollection.setCorrelationExpression(getExpression());
            }
            if (aggregationCollection.getAggregationStrategy() == null) {
                AggregationStrategy strategy = createAggregationStrategy(routeContext);
                aggregationCollection.setAggregationStrategy(strategy);
            }
            aggregator = new Aggregator(processor, aggregationCollection);
        } else {
            // create the aggregator using a default collection
            AggregationStrategy strategy = createAggregationStrategy(routeContext);

            if (getExpression() == null) {
                throw new IllegalArgumentException("You need to specify an expression or "
                                                   + "aggregation collection for this aggregator: " + this);
            }
           
            Expression aggregateExpression = getExpression().createExpression(routeContext);          

            Predicate predicate = null;
            if (getCompletionPredicate() != null) {
                predicate = getCompletionPredicate().createPredicate(routeContext);
            }
            if (predicate != null) {
                aggregator = new Aggregator(processor, aggregateExpression, strategy, predicate);
            } else {
                aggregator = new Aggregator(processor, aggregateExpression, strategy);
            }
        }
       
        if (batchSize != null) {
            aggregator.setBatchSize(batchSize);
        }
        if (batchTimeout != null) {
            aggregator.setBatchTimeout(batchTimeout);
        }
        if (outBatchSize != null) {
            aggregator.setOutBatchSize(outBatchSize);
        }
        if (groupExchanges != null) {
            aggregator.setGroupExchanges(groupExchanges);
        }
        if (batchSizeFromConsumer != null) {
            aggregator.setBatchConsumer(batchSizeFromConsumer);
        }

        return aggregator;
    }
View Full Code Here

    }
   
    protected Aggregator createAggregator(RouteContext routeContext) throws Exception {
        final Processor processor = routeContext.createProcessor(this);

        final Aggregator aggregator;
        if (getAggregationCollection() == null) {
            setAggregationCollection(createAggregationCollection(routeContext));
        }
       
        if (aggregationCollection != null) {
            // create the aggregator using the collection
            // pre configure the collection if its expression and strategy is not set, then
            // use the ones that is pre configured with this type
            if (aggregationCollection.getCorrelationExpression() == null) {
                aggregationCollection.setCorrelationExpression(getExpression());
            }
            if (aggregationCollection.getAggregationStrategy() == null) {
                AggregationStrategy strategy = createAggregationStrategy(routeContext);
                aggregationCollection.setAggregationStrategy(strategy);
            }
            aggregator = new Aggregator(processor, aggregationCollection);
        } else {
            // create the aggregator using a default collection
            AggregationStrategy strategy = createAggregationStrategy(routeContext);

            if (getExpression() == null) {
                throw new IllegalArgumentException("You need to specify an expression or "
                                                   + "aggregation collection for this aggregator: " + this);
            }
           
            Expression aggregateExpression = getExpression().createExpression(routeContext);          

            Predicate predicate = null;
            if (getCompletionPredicate() != null) {
                predicate = getCompletionPredicate().createPredicate(routeContext);
            }
            if (predicate != null) {
                aggregator = new Aggregator(processor, aggregateExpression, strategy, predicate);
            } else {
                aggregator = new Aggregator(processor, aggregateExpression, strategy);
            }
        }
       
        if (batchSize != null) {
            aggregator.setBatchSize(batchSize);
        }
        if (batchTimeout != null) {
            aggregator.setBatchTimeout(batchTimeout);
        }
        if (outBatchSize != null) {
            aggregator.setOutBatchSize(outBatchSize);
        }
        if (groupExchanges != null) {
            aggregator.setGroupExchanges(groupExchanges);
        }
        if (batchSizeFromConsumer != null) {
            aggregator.setBatchConsumer(batchSizeFromConsumer);
        }

        return aggregator;
    }
View Full Code Here

    }
   
    protected Aggregator createAggregator(RouteContext routeContext) throws Exception {
        final Processor processor = routeContext.createProcessor(this);

        final Aggregator aggregator;
        if (getAggregationCollection() == null) {
            setAggregationCollection(createAggregationCollection(routeContext));
        }
       
        if (aggregationCollection != null) {
            // create the aggregator using the collection
            // pre configure the collection if its expression and strategy is not set, then
            // use the ones that is pre configured with this type
            if (aggregationCollection.getCorrelationExpression() == null) {
                aggregationCollection.setCorrelationExpression(getExpression());
            }
            if (aggregationCollection.getAggregationStrategy() == null) {
                AggregationStrategy strategy = createAggregationStrategy(routeContext);
                aggregationCollection.setAggregationStrategy(strategy);
            }
            aggregator = new Aggregator(processor, aggregationCollection);
        } else {
            // create the aggregator using a default collection
            AggregationStrategy strategy = createAggregationStrategy(routeContext);

            if (getExpression() == null) {
                throw new IllegalArgumentException("You need to specify an expression or "
                                                   + "aggregation collection for this aggregator: " + this);
            }
           
            Expression aggregateExpression = getExpression().createExpression(routeContext);          

            Predicate predicate = null;
            if (getCompletionPredicate() != null) {
                predicate = getCompletionPredicate().createPredicate(routeContext);
            }
            if (predicate != null) {
                aggregator = new Aggregator(processor, aggregateExpression, strategy, predicate);
            } else {
                aggregator = new Aggregator(processor, aggregateExpression, strategy);
            }
        }
       
        if (batchSize != null) {
            aggregator.setBatchSize(batchSize);
        }
        if (batchTimeout != null) {
            aggregator.setBatchTimeout(batchTimeout);
        }
        if (outBatchSize != null) {
            aggregator.setOutBatchSize(outBatchSize);
        }
        if (groupExchanges != null) {
            aggregator.setGroupExchanges(groupExchanges);
        }
        if (batchSizeFromConsumer != null) {
            aggregator.setBatchConsumer(batchSizeFromConsumer);
        }

        return aggregator;
    }
View Full Code Here

    }
   
    protected Aggregator createAggregator(RouteContext routeContext) throws Exception {
        final Processor processor = routeContext.createProcessor(this);

        final Aggregator aggregator;
        if (getAggregationCollection() == null) {
            setAggregationCollection(createAggregationCollection(routeContext));
        }
       
        if (aggregationCollection != null) {
            // create the aggregator using the collection
            // pre configure the collection if its expression and strategy is not set, then
            // use the ones that is pre configured with this type
            if (aggregationCollection.getCorrelationExpression() == null) {
                aggregationCollection.setCorrelationExpression(getExpression());
            }
            if (aggregationCollection.getAggregationStrategy() == null) {
                AggregationStrategy strategy = createAggregationStrategy(routeContext);
                aggregationCollection.setAggregationStrategy(strategy);
            }
            aggregator = new Aggregator(processor, aggregationCollection);
        } else {
            // create the aggregator using a default collection
            AggregationStrategy strategy = createAggregationStrategy(routeContext);

            if (getExpression() == null) {
                throw new IllegalArgumentException("You need to specify an expression or "
                                                   + "aggregation collection for this aggregator: " + this);
            }
           
            Expression aggregateExpression = getExpression().createExpression(routeContext);          

            Predicate predicate = null;
            if (getCompletionPredicate() != null) {
                predicate = getCompletionPredicate().createPredicate(routeContext);
            }
            if (predicate != null) {
                aggregator = new Aggregator(processor, aggregateExpression, strategy, predicate);
            } else {
                aggregator = new Aggregator(processor, aggregateExpression, strategy);
            }
        }
       
        if (batchSize != null) {
            aggregator.setBatchSize(batchSize);
        }
        if (batchTimeout != null) {
            aggregator.setBatchTimeout(batchTimeout);
        }
        if (outBatchSize != null) {
            aggregator.setOutBatchSize(outBatchSize);
        }
        if (groupExchanges != null) {
            aggregator.setGroupExchanges(groupExchanges);
        }
        if (batchSizeFromConsumer != null) {
            aggregator.setBatchConsumer(batchSizeFromConsumer);
        }

        return aggregator;
    }
View Full Code Here

TOP

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

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.