use of org.mule.runtime.core.api.processor.strategy.AsyncProcessingStrategyFactory in project mule by mulesoft.
the class AsyncDelegateMessageProcessor method initialise.
@Override
public void initialise() throws InitialisationException {
Object rootContainer = getFromAnnotatedObject(componentLocator, this).orElse(null);
if (rootContainer instanceof FlowConstruct) {
if (maxConcurrency != null && rootContainer instanceof Pipeline) {
ProcessingStrategyFactory flowPsFactory = ((Pipeline) rootContainer).getProcessingStrategyFactory();
if (flowPsFactory instanceof AsyncProcessingStrategyFactory) {
((AsyncProcessingStrategyFactory) flowPsFactory).setMaxConcurrency(maxConcurrency);
} else {
logger.warn("{} does not support 'maxConcurrency'. Ignoring the value.", flowPsFactory.getClass().getSimpleName());
}
processingStrategy = flowPsFactory.create(muleContext, getLocation().getLocation());
ownProcessingStrategy = true;
} else {
processingStrategy = ((FlowConstruct) rootContainer).getProcessingStrategy();
}
} else {
processingStrategy = DIRECT_PROCESSING_STRATEGY_INSTANCE;
}
if (delegateBuilder == null) {
throw new InitialisationException(objectIsNull("delegate message processor"), this);
}
delegateBuilder.setProcessingStrategy(processingStrategy);
delegate = delegateBuilder.build();
initialiseIfNeeded(delegate, muleContext);
super.initialise();
}
Aggregations