Search in sources :

Example 6 with DefaultMessageProcessorChainBuilder

use of org.mule.runtime.core.privileged.processor.chain.DefaultMessageProcessorChainBuilder in project mule by mulesoft.

the class AsyncMessageProcessorsFactoryBean method getObject.

@Override
public AsyncDelegateMessageProcessor getObject() throws Exception {
    DefaultMessageProcessorChainBuilder builder = new DefaultMessageProcessorChainBuilder();
    builder.setName("'async' child chain");
    for (Object processor : messageProcessors) {
        if (processor instanceof Processor) {
            builder.chain((Processor) processor);
        } else if (processor instanceof MessageProcessorBuilder) {
            builder.chain((MessageProcessorBuilder) processor);
        } else {
            throw new IllegalArgumentException("MessageProcessorBuilder should only have MessageProcessor's or MessageProcessorBuilder's configured");
        }
    }
    AsyncDelegateMessageProcessor delegate = new AsyncDelegateMessageProcessor(builder, name);
    delegate.setAnnotations(getAnnotations());
    if (getMaxConcurrency() != null) {
        delegate.setMaxConcurrency(getMaxConcurrency());
    }
    return delegate;
}
Also used : DefaultMessageProcessorChainBuilder(org.mule.runtime.core.privileged.processor.chain.DefaultMessageProcessorChainBuilder) Processor(org.mule.runtime.core.api.processor.Processor) AsyncDelegateMessageProcessor(org.mule.runtime.core.internal.processor.AsyncDelegateMessageProcessor) NameableObject(org.mule.runtime.api.meta.NameableObject) AsyncDelegateMessageProcessor(org.mule.runtime.core.internal.processor.AsyncDelegateMessageProcessor) MessageProcessorBuilder(org.mule.runtime.core.privileged.processor.MessageProcessorBuilder)

Example 7 with DefaultMessageProcessorChainBuilder

use of org.mule.runtime.core.privileged.processor.chain.DefaultMessageProcessorChainBuilder in project mule by mulesoft.

the class MessageProcessorFilterPairFactoryBean method doGetObject.

@Override
public MessageProcessorExpressionPair doGetObject() throws Exception {
    final DefaultMessageProcessorChainBuilder builder = new DefaultMessageProcessorChainBuilder();
    for (Object processor : messageProcessors) {
        if (processor instanceof Processor) {
            builder.chain((Processor) processor);
        } else if (processor instanceof MessageProcessorBuilder) {
            builder.chain((MessageProcessorBuilder) processor);
        } else {
            throw new IllegalArgumentException("MessageProcessorBuilder should only have MessageProcessors or MessageProcessorBuilders configured");
        }
    }
    MessageProcessorExpressionPair filterPair = new MessageProcessorExpressionPair(expression, newLazyProcessorChainBuilder(builder, muleContext, () -> getProcessingStrategy(locator, getRootContainerLocation()).orElse(null)));
    return filterPair;
}
Also used : DefaultMessageProcessorChainBuilder(org.mule.runtime.core.privileged.processor.chain.DefaultMessageProcessorChainBuilder) Processor(org.mule.runtime.core.api.processor.Processor) MessageProcessorBuilder(org.mule.runtime.core.privileged.processor.MessageProcessorBuilder) MessageProcessorExpressionPair(org.mule.runtime.core.internal.routing.MessageProcessorExpressionPair)

Example 8 with DefaultMessageProcessorChainBuilder

use of org.mule.runtime.core.privileged.processor.chain.DefaultMessageProcessorChainBuilder in project mule by mulesoft.

the class ProcessorChainBenchmark method setup.

@Setup
public void setup() throws Exception {
    DefaultMessageProcessorChainBuilder builder = new DefaultMessageProcessorChainBuilder();
    for (int i = 0; i < NUM_PROCESSORS; i++) {
        builder.chain(event -> event);
    }
    chain = builder.build();
    chain.setMuleContext(createMuleContextWithServices());
    event = builder(create("", "", CONNECTOR_LOCATION, NullExceptionHandler.getInstance())).message(of(PAYLOAD)).build();
}
Also used : DefaultMessageProcessorChainBuilder(org.mule.runtime.core.privileged.processor.chain.DefaultMessageProcessorChainBuilder) Setup(org.openjdk.jmh.annotations.Setup)

Example 9 with DefaultMessageProcessorChainBuilder

use of org.mule.runtime.core.privileged.processor.chain.DefaultMessageProcessorChainBuilder in project mule by mulesoft.

the class AsyncRequestReplyRequesterTestCase method createAsyncMessageProcessor.

protected AsyncDelegateMessageProcessor createAsyncMessageProcessor(SensingNullMessageProcessor target) throws InitialisationException {
    DefaultMessageProcessorChainBuilder delegateBuilder = new DefaultMessageProcessorChainBuilder();
    delegateBuilder.chain(target);
    asyncMP = new AsyncDelegateMessageProcessor(delegateBuilder);
    asyncMP.setAnnotations(getAppleFlowComponentLocationAnnotations());
    initialiseIfNeeded(asyncMP, true, muleContext);
    return asyncMP;
}
Also used : DefaultMessageProcessorChainBuilder(org.mule.runtime.core.privileged.processor.chain.DefaultMessageProcessorChainBuilder) AsyncDelegateMessageProcessor(org.mule.runtime.core.internal.processor.AsyncDelegateMessageProcessor)

Example 10 with DefaultMessageProcessorChainBuilder

use of org.mule.runtime.core.privileged.processor.chain.DefaultMessageProcessorChainBuilder in project mule by mulesoft.

the class MessageProcessorChainObjectFactory method getBuilderInstance.

protected MessageProcessorChainBuilder getBuilderInstance() {
    DefaultMessageProcessorChainBuilder builder = new DefaultMessageProcessorChainBuilder();
    builder.setName("processor chain '" + name + "'");
    return builder;
}
Also used : DefaultMessageProcessorChainBuilder(org.mule.runtime.core.privileged.processor.chain.DefaultMessageProcessorChainBuilder)

Aggregations

DefaultMessageProcessorChainBuilder (org.mule.runtime.core.privileged.processor.chain.DefaultMessageProcessorChainBuilder)16 Test (org.junit.Test)5 Processor (org.mule.runtime.core.api.processor.Processor)4 AsyncDelegateMessageProcessor (org.mule.runtime.core.internal.processor.AsyncDelegateMessageProcessor)3 MessageProcessorBuilder (org.mule.runtime.core.privileged.processor.MessageProcessorBuilder)3 Description (io.qameta.allure.Description)1 CompletableFuture (java.util.concurrent.CompletableFuture)1 TimeoutException (java.util.concurrent.TimeoutException)1 NameableObject (org.mule.runtime.api.meta.NameableObject)1 Latch (org.mule.runtime.api.util.concurrent.Latch)1 ReactiveProcessor (org.mule.runtime.core.api.processor.ReactiveProcessor)1 ResponseMessageProcessorAdapter (org.mule.runtime.core.internal.processor.ResponseMessageProcessorAdapter)1 MessageProcessorExpressionPair (org.mule.runtime.core.internal.routing.MessageProcessorExpressionPair)1 MessageProcessorChain (org.mule.runtime.core.privileged.processor.chain.MessageProcessorChain)1 Setup (org.openjdk.jmh.annotations.Setup)1