Search in sources :

Example 1 with Pipeline

use of org.mule.runtime.core.api.construct.Pipeline in project mule by mulesoft.

the class MessageProcessingFlowTraceManagerTestCase method buildPipelineNotification.

protected PipelineMessageNotification buildPipelineNotification(CoreEvent event, String name) {
    Pipeline flowConstruct = mock(Pipeline.class, withSettings().extraInterfaces(Component.class));
    when(flowConstruct.getName()).thenReturn(name);
    return new PipelineMessageNotification(createInfo(event, null, flowConstruct), flowConstruct.getName(), PROCESS_START);
}
Also used : PipelineMessageNotification(org.mule.runtime.api.notification.PipelineMessageNotification) Component(org.mule.runtime.api.component.Component) Pipeline(org.mule.runtime.core.api.construct.Pipeline)

Example 2 with Pipeline

use of org.mule.runtime.core.api.construct.Pipeline 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();
}
Also used : FlowConstruct(org.mule.runtime.core.api.construct.FlowConstruct) ProcessingStrategyFactory(org.mule.runtime.core.api.processor.strategy.ProcessingStrategyFactory) AsyncProcessingStrategyFactory(org.mule.runtime.core.api.processor.strategy.AsyncProcessingStrategyFactory) ComponentUtils.getFromAnnotatedObject(org.mule.runtime.core.internal.component.ComponentUtils.getFromAnnotatedObject) InitialisationException(org.mule.runtime.api.lifecycle.InitialisationException) AsyncProcessingStrategyFactory(org.mule.runtime.core.api.processor.strategy.AsyncProcessingStrategyFactory) Pipeline(org.mule.runtime.core.api.construct.Pipeline)

Aggregations

Pipeline (org.mule.runtime.core.api.construct.Pipeline)2 Component (org.mule.runtime.api.component.Component)1 InitialisationException (org.mule.runtime.api.lifecycle.InitialisationException)1 PipelineMessageNotification (org.mule.runtime.api.notification.PipelineMessageNotification)1 FlowConstruct (org.mule.runtime.core.api.construct.FlowConstruct)1 AsyncProcessingStrategyFactory (org.mule.runtime.core.api.processor.strategy.AsyncProcessingStrategyFactory)1 ProcessingStrategyFactory (org.mule.runtime.core.api.processor.strategy.ProcessingStrategyFactory)1 ComponentUtils.getFromAnnotatedObject (org.mule.runtime.core.internal.component.ComponentUtils.getFromAnnotatedObject)1