} else {
// use a synchronous thread pool if we are not running in parallel (will always use caller thread)
executorService = routeContext.getCamelContext().getExecutorServiceStrategy().newSynchronousThreadPool(this, "Aggregator");
}
}
AggregateProcessor answer = new AggregateProcessor(routeContext.getCamelContext(), processor, correlation, strategy, executorService);
AggregationRepository repository = createAggregationRepository(routeContext);
if (repository != null) {
answer.setAggregationRepository(repository);
}
// set other options
answer.setParallelProcessing(isParallelProcessing());
if (getCompletionPredicate() != null) {
Predicate predicate = getCompletionPredicate().createPredicate(routeContext);
answer.setCompletionPredicate(predicate);
}
if (getCompletionTimeoutExpression() != null) {
Expression expression = getCompletionTimeoutExpression().createExpression(routeContext);
answer.setCompletionTimeoutExpression(expression);
}
if (getCompletionTimeout() != null) {
answer.setCompletionTimeout(getCompletionTimeout());
}
if (getCompletionInterval() != null) {
answer.setCompletionInterval(getCompletionInterval());
}
if (getCompletionSizeExpression() != null) {
Expression expression = getCompletionSizeExpression().createExpression(routeContext);
answer.setCompletionSizeExpression(expression);
}
if (getCompletionSize() != null) {
answer.setCompletionSize(getCompletionSize());
}
if (getCompletionFromBatchConsumer() != null) {
answer.setCompletionFromBatchConsumer(isCompletionFromBatchConsumer());
}
if (getEagerCheckCompletion() != null) {
answer.setEagerCheckCompletion(isEagerCheckCompletion());
}
if (getIgnoreInvalidCorrelationKeys() != null) {
answer.setIgnoreInvalidCorrelationKeys(isIgnoreInvalidCorrelationKeys());
}
if (getCloseCorrelationKeyOnCompletion() != null) {
answer.setCloseCorrelationKeyOnCompletion(getCloseCorrelationKeyOnCompletion());
}
if (getDiscardOnCompletionTimeout() != null) {
answer.setDiscardOnCompletionTimeout(isDiscardOnCompletionTimeout());
}
return answer;
}