Search in sources :

Example 1 with MessageProcessorExpressionPair

use of org.mule.runtime.core.internal.routing.MessageProcessorExpressionPair 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 2 with MessageProcessorExpressionPair

use of org.mule.runtime.core.internal.routing.MessageProcessorExpressionPair in project mule by mulesoft.

the class AbstractSelectiveRouterObjectFactory method doGetObject.

@Override
public AbstractSelectiveRouter doGetObject() throws Exception {
    final AbstractSelectiveRouter router = newAbstractSelectiveRouter();
    router.setAnnotations(getAnnotations());
    router.setDefaultRoute(defaultProcessor);
    router.setMuleContext(muleContext);
    for (final MessageProcessorExpressionPair mpfp : conditionalMessageProcessors) {
        router.addRoute(mpfp.getExpression(), mpfp.getMessageProcessor());
    }
    return router;
}
Also used : AbstractSelectiveRouter(org.mule.runtime.core.internal.routing.AbstractSelectiveRouter) MessageProcessorExpressionPair(org.mule.runtime.core.internal.routing.MessageProcessorExpressionPair)

Aggregations

MessageProcessorExpressionPair (org.mule.runtime.core.internal.routing.MessageProcessorExpressionPair)2 Processor (org.mule.runtime.core.api.processor.Processor)1 AbstractSelectiveRouter (org.mule.runtime.core.internal.routing.AbstractSelectiveRouter)1 MessageProcessorBuilder (org.mule.runtime.core.privileged.processor.MessageProcessorBuilder)1 DefaultMessageProcessorChainBuilder (org.mule.runtime.core.privileged.processor.chain.DefaultMessageProcessorChainBuilder)1