Package org.mule.api.processor

Examples of org.mule.api.processor.MessageProcessor


    public void testProcessors() throws Exception
    {
        DefaultMessageProcessorChainBuilder builder = new DefaultMessageProcessorChainBuilder();
        builder.chain(new TestMessageProcessor("1"), new TestMessageProcessor("2"), new TestMessageProcessor("3"));
        MessageProcessor mpChain = builder.build();
       
        result = mpChain.process(testOutboundEvent);
        assertEquals(TEST_MESSAGE + ":1:2:3", result.getMessage().getPayload());
    }
View Full Code Here


    }

    public void testNoProcessors() throws Exception
    {
        DefaultMessageProcessorChainBuilder builder = new DefaultMessageProcessorChainBuilder();
        MessageProcessor mpChain = builder.build();
       
        result = mpChain.process(testOutboundEvent);
        assertEquals(TEST_MESSAGE, result.getMessage().getPayload());
    }
View Full Code Here

        LinkedList<MessageProcessor> tempList = new LinkedList<MessageProcessor>();

        // Start from last but one message processor and work backwards
        for (int i = processors.size() - 1; i >= 0; i--)
        {
            MessageProcessor processor = initializeMessageProcessor(processors.get(i));
            if (processor instanceof InterceptingMessageProcessor)
            {
                InterceptingMessageProcessor interceptingProcessor = (InterceptingMessageProcessor) processor;
                // Processor is intercepting so we can't simply iterate
                if (i + 1 < processors.size())
View Full Code Here

        {
            // if there's a policy, adapt, so it can call through to the doProcess() method
            // TODO I hate to do this, and there are no method delegates in java.
            // This doProcess() must be abstracted into some chain processor which has the logic,
            // and have the chain handle the plumbing only
            PolicyInvocation invocation = new PolicyInvocation(event, activePolicies, new MessageProcessor()
            {
                public MuleEvent process(MuleEvent event) throws MuleException
                {
                    return doProcess(event);
                }
View Full Code Here

        if (mpIterator.hasNext())
        {
            string.append(String.format("%n[ "));
            while (mpIterator.hasNext())
            {
                MessageProcessor mp = mpIterator.next();
                final String indented = StringUtils.replace(mp.toString(), nl, String.format("%n  "));
                string.append(String.format("%n  %s", indented));
                if (mpIterator.hasNext())
                {
                    string.append(", ");
                }
View Full Code Here

        if (processorArgExpression != null)
        {
            messageToProcess = evaluateProcessorArgument(message, processorArgExpression);
        }

        MessageProcessor processor = lookupMessageProcessor(processorName, muleContext);

        try
        {
            return processor.process(new DefaultMuleEvent(messageToProcess, RequestContext.getEvent()))
                .getMessage();
        }
        catch (MuleException e)
        {
            throw new ExpressionRuntimeException(
View Full Code Here

        {
            throw new MuleRuntimeException(CoreMessages.objectIsNull(name));
        }
        else if (!referenceCache.containsKey(name))
        {
            MessageProcessor dynamicReference = new MessageProcessor()
            {
                @Override
                public MuleEvent process(MuleEvent event) throws MuleException
                {
                    // Need to initialize because message processor won't be managed by parent
                    MessageProcessor dynamicMessageProcessor = getReferencedFlow(muleContext.getExpressionManager()
                        .parse(refName, event), event.getFlowConstruct());
                    return dynamicMessageProcessor.process(event);
                }
            };
            if (dynamicReference instanceof Initialisable)
            {
                ((Initialisable) dynamicReference).initialise();
View Full Code Here

            throw new MuleRuntimeException(CoreMessages.objectIsNull(name));
        }
        String categorizedName = getReferencedFlowCategorizedName(name, flowConstruct);
        if (!referenceCache.containsKey(categorizedName))
        {
            MessageProcessor referencedFlow = lookupReferencedFlowInApplicationContext(name);
            if (referencedFlow instanceof Initialisable)
            {
                if(referencedFlow instanceof MessageProcessorChain)
                {
                    for(MessageProcessor processor : ((MessageProcessorChain) referencedFlow).getMessageProcessors())
View Full Code Here

        return MULE_PREFIX + flowConstructName + "-" + referencedFlowName;
    }

    protected MessageProcessor lookupReferencedFlowInApplicationContext(String name)
    {
        final MessageProcessor referencedFlow = ((MessageProcessor) applicationContext.getBean(name));
        if (referencedFlow == null)
        {
            throw new MuleRuntimeException(CoreMessages.objectIsNull(name));
        }
        if (referencedFlow instanceof FlowConstruct)
        {
            return new MessageProcessor()
            {
                @Override
                public MuleEvent process(MuleEvent event) throws MuleException
                {
                    return referencedFlow.process(event);
                }
            };
        }
        else
        {
View Full Code Here

            }

            proxyBuilder.chain(dynamicOutboundEndpoint);
        }

        MessageProcessor proxyMessageProcessor;
        if (cachingStrategy != null)
        {
            final MessageProcessorChain cachedMessageProcessors = proxyBuilder.build();

            proxyMessageProcessor = new MessageProcessor()
            {

                @Override
                public MuleEvent process(MuleEvent event) throws MuleException
                {
View Full Code Here

TOP

Related Classes of org.mule.api.processor.MessageProcessor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.