Package org.apache.camel.model

Examples of org.apache.camel.model.AggregateDefinition


                        .aggregate(header(SURNAME_HEADER),
                                surnameAggregator).setHeader(TYPE_HEADER,
                        constant(BROTHERS_TYPE)).to("direct:joinBrothers");

                // Join all brothers lists and remove surname and type headers
                AggregateDefinition agg =
                        from("direct:joinBrothers").aggregate(header(TYPE_HEADER),
                                brothersAggregator);

                agg.setBatchTimeout(2000L);
                agg.removeHeader(SURNAME_HEADER)
                        .removeHeader(TYPE_HEADER)
                        .to("mock:result");
            }
        };
    }
View Full Code Here


    }

    @SuppressWarnings("rawtypes")
    @Override
    public ProcessorDefinition createCamelDefinition() {
        AggregateDefinition answer = new AggregateDefinition();

        answer.setInheritErrorHandler(toXmlPropertyValue(PROPERTY_INHERITERRORHANDLER, Objects.<Boolean>getField(this, "inheritErrorHandler")));
        Objects.setField(answer, "correlationExpression", toXmlPropertyValue(PROPERTY_CORRELATIONEXPRESSION, this.getCorrelationExpression()));
        Objects.setField(answer, "completionPredicate", toXmlPropertyValue(PROPERTY_COMPLETIONPREDICATE, this.getCompletionPredicate()));
        Objects.setField(answer, "completionTimeoutExpression", toXmlPropertyValue(PROPERTY_COMPLETIONTIMEOUTEXPRESSION, this.getCompletionTimeoutExpression()));
        Objects.setField(answer, "completionSizeExpression", toXmlPropertyValue(PROPERTY_COMPLETIONSIZEEXPRESSION, this.getCompletionSizeExpression()));
        Objects.setField(answer, "parallelProcessing", toXmlPropertyValue(PROPERTY_PARALLELPROCESSING, this.getParallelProcessing()));
        Objects.setField(answer, "optimisticLocking", toXmlPropertyValue(PROPERTY_OPTIMISTICLOCKING, this.getOptimisticLocking()));
        answer.setExecutorServiceRef(toXmlPropertyValue(PROPERTY_EXECUTORSERVICEREF, this.getExecutorServiceRef()));
        answer.setTimeoutCheckerExecutorServiceRef(toXmlPropertyValue(PROPERTY_TIMEOUTCHECKEREXECUTORSERVICEREF, this.getTimeoutCheckerExecutorServiceRef()));
        answer.setAggregationRepositoryRef(toXmlPropertyValue(PROPERTY_AGGREGATIONREPOSITORYREF, this.getAggregationRepositoryRef()));
        answer.setStrategyRef(toXmlPropertyValue(PROPERTY_STRATEGYREF, this.getStrategyRef()));
        answer.setStrategyMethodName(toXmlPropertyValue(PROPERTY_STRATEGYMETHODNAME, this.getStrategyMethodName()));
        answer.setStrategyMethodAllowNull(toXmlPropertyValue(PROPERTY_STRATEGYMETHODALLOWNULL, this.getStrategyMethodAllowNull()));
        answer.setCompletionSize(toXmlPropertyValue(PROPERTY_COMPLETIONSIZE, this.getCompletionSize()));
        answer.setCompletionInterval(toXmlPropertyValue(PROPERTY_COMPLETIONINTERVAL, this.getCompletionInterval()));
        answer.setCompletionTimeout(toXmlPropertyValue(PROPERTY_COMPLETIONTIMEOUT, this.getCompletionTimeout()));
        answer.setCompletionFromBatchConsumer(toXmlPropertyValue(PROPERTY_COMPLETIONFROMBATCHCONSUMER, this.getCompletionFromBatchConsumer()));
        answer.setGroupExchanges(toXmlPropertyValue(PROPERTY_GROUPEXCHANGES, this.getGroupExchanges()));
        answer.setEagerCheckCompletion(toXmlPropertyValue(PROPERTY_EAGERCHECKCOMPLETION, this.getEagerCheckCompletion()));
        answer.setIgnoreInvalidCorrelationKeys(toXmlPropertyValue(PROPERTY_IGNOREINVALIDCORRELATIONKEYS, this.getIgnoreInvalidCorrelationKeys()));
        answer.setCloseCorrelationKeyOnCompletion(toXmlPropertyValue(PROPERTY_CLOSECORRELATIONKEYONCOMPLETION, this.getCloseCorrelationKeyOnCompletion()));
        answer.setDiscardOnCompletionTimeout(toXmlPropertyValue(PROPERTY_DISCARDONCOMPLETIONTIMEOUT, this.getDiscardOnCompletionTimeout()));
        answer.setForceCompletionOnStop(toXmlPropertyValue(PROPERTY_FORCECOMPLETIONONSTOP, this.getForceCompletionOnStop()));
        answer.setOptimisticLockRetryPolicyDefinition(toXmlPropertyValue(PROPERTY_OPTIMISTICLOCKRETRYPOLICYDEFINITION, this.getOptimisticLockRetryPolicyDefinition()));

        super.savePropertiesToCamelDefinition(answer);
        return answer;
    }
View Full Code Here

    @Override
    protected void loadPropertiesFromCamelDefinition(ProcessorDefinition processor) {
        super.loadPropertiesFromCamelDefinition(processor);

        if (processor instanceof AggregateDefinition) {
            AggregateDefinition node = (AggregateDefinition) processor;

            this.setInheritErrorHandler(Objects.<Boolean>getField(node, "inheritErrorHandler"));
            Objects.setField(this, "correlationExpression", node.getCorrelationExpression());
            Objects.setField(this, "completionPredicate", node.getCompletionPredicate());
            Objects.setField(this, "completionTimeoutExpression", node.getCompletionTimeoutExpression());
            Objects.setField(this, "completionSizeExpression", node.getCompletionSizeExpression());
            Objects.setField(this, "parallelProcessing", node.getParallelProcessing());
            Objects.setField(this, "optimisticLocking", node.getOptimisticLocking());
            this.setExecutorServiceRef(node.getExecutorServiceRef());
            this.setTimeoutCheckerExecutorServiceRef(node.getTimeoutCheckerExecutorServiceRef());
            this.setAggregationRepositoryRef(node.getAggregationRepositoryRef());
            this.setStrategyRef(node.getStrategyRef());
            this.setStrategyMethodName(node.getStrategyMethodName());
            this.setStrategyMethodAllowNull(node.getStrategyMethodAllowNull());
            this.setCompletionSize(node.getCompletionSize());
            this.setCompletionInterval(node.getCompletionInterval());
            this.setCompletionTimeout(node.getCompletionTimeout());
            this.setCompletionFromBatchConsumer(node.getCompletionFromBatchConsumer());
            this.setGroupExchanges(node.getGroupExchanges());
            this.setEagerCheckCompletion(node.getEagerCheckCompletion());
            this.setIgnoreInvalidCorrelationKeys(node.getIgnoreInvalidCorrelationKeys());
            this.setCloseCorrelationKeyOnCompletion(node.getCloseCorrelationKeyOnCompletion());
            this.setDiscardOnCompletionTimeout(node.getDiscardOnCompletionTimeout());
            this.setForceCompletionOnStop(node.getForceCompletionOnStop());
            this.setOptimisticLockRetryPolicyDefinition(node.getOptimisticLockRetryPolicyDefinition());
        } else {
            throw new IllegalArgumentException("ProcessorDefinition not an instanceof AggregateDefinition. Was " + processor.getClass().getName());
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.camel.model.AggregateDefinition

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.