Search in sources :

Example 1 with MessageProcessorBuilder

use of org.mule.runtime.core.privileged.processor.MessageProcessorBuilder 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 2 with MessageProcessorBuilder

use of org.mule.runtime.core.privileged.processor.MessageProcessorBuilder 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 3 with MessageProcessorBuilder

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

the class ResponseMessageProcessorsFactoryBean method doGetObject.

@Override
public ResponseMessageProcessorAdapter doGetObject() throws Exception {
    DefaultMessageProcessorChainBuilder builder = new DefaultMessageProcessorChainBuilder();
    builder.setName("'response' child processor 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");
        }
    }
    ResponseMessageProcessorAdapter responseAdapter = new ResponseMessageProcessorAdapter();
    responseAdapter.setProcessor(newLazyProcessorChainBuilder(builder, muleContext, () -> getProcessingStrategy(locator, getRootContainerLocation()).orElse(null)));
    responseAdapter.setMuleContext(muleContext);
    return responseAdapter;
}
Also used : DefaultMessageProcessorChainBuilder(org.mule.runtime.core.privileged.processor.chain.DefaultMessageProcessorChainBuilder) ResponseMessageProcessorAdapter(org.mule.runtime.core.internal.processor.ResponseMessageProcessorAdapter) Processor(org.mule.runtime.core.api.processor.Processor) MessageProcessorBuilder(org.mule.runtime.core.privileged.processor.MessageProcessorBuilder)

Aggregations

Processor (org.mule.runtime.core.api.processor.Processor)3 MessageProcessorBuilder (org.mule.runtime.core.privileged.processor.MessageProcessorBuilder)3 DefaultMessageProcessorChainBuilder (org.mule.runtime.core.privileged.processor.chain.DefaultMessageProcessorChainBuilder)3 NameableObject (org.mule.runtime.api.meta.NameableObject)1 AsyncDelegateMessageProcessor (org.mule.runtime.core.internal.processor.AsyncDelegateMessageProcessor)1 ResponseMessageProcessorAdapter (org.mule.runtime.core.internal.processor.ResponseMessageProcessorAdapter)1 MessageProcessorExpressionPair (org.mule.runtime.core.internal.routing.MessageProcessorExpressionPair)1