Package org.mule

Examples of org.mule.DefaultMuleEvent$NullInboundEndpoint


    int maxRedelivery;

    public MessageRedeliveredException(String messageId, int redeliveryCount, int maxRedelivery, InboundEndpoint endpoint, FlowConstruct flow, MuleMessage muleMessage)
    {       
        super(JmsMessages.tooManyRedeliveries(messageId, redeliveryCount, maxRedelivery, endpoint),
            new DefaultMuleEvent(muleMessage, endpoint, new DefaultMuleSession(flow, endpoint.getMuleContext())));
        this.messageId = messageId;
        this.redeliveryCount = redeliveryCount;
        this.maxRedelivery = maxRedelivery;
        this.endpoint = endpoint;
    }
View Full Code Here


        message2.setCorrelationId(message1.getUniqueId());
        message3.setCorrelationId(message1.getUniqueId());
        message1.setCorrelationGroupSize(3);

        InboundEndpoint endpoint = MuleTestUtils.getTestInboundEndpoint(MessageExchangePattern.ONE_WAY, muleContext);
        MuleEvent event1 = new DefaultMuleEvent(message1, endpoint, session);
        MuleEvent event2 = new DefaultMuleEvent(message2, endpoint, session);
        MuleEvent event3 = new DefaultMuleEvent(message3, endpoint, session);

        assertNull(router.process(event1));
        assertNull(router.process(event2));
        MuleEvent resultEvent = router.process(event3);
        assertNotNull(resultEvent);
View Full Code Here

        FruitBowl fruitBowl = new FruitBowl();
        fruitBowl.addFruit(apple);
        fruitBowl.addFruit(banana);
        fruitBowl.addFruit(orange);

        MuleEvent inEvent = new DefaultMuleEvent(new DefaultMuleMessage(fruitBowl, muleContext),
            getTestEvent(""));

        MuleEvent resultEvent = splitter.process(inEvent);

        assertEquals(3, listener.events.size());
View Full Code Here

        eg.addEvent(e);
        es = eg.toString();
        assertTrue(es.indexOf("events=1") != -1);
        assertTrue(es.endsWith("[" + e.getMessage().getUniqueId() + "]}"));

        MuleEvent e2 = new DefaultMuleEvent(new DefaultMuleMessage("foo2", muleContext), e);
        eg.addEvent(e2);
        es = eg.toString();
        assertTrue(es.indexOf("events=2") != -1);
        assertTrue(es.endsWith(e.getMessage().getUniqueId() + ", " + e2.getMessage().getUniqueId() + "]}"));
    }
View Full Code Here

        message1.setCorrelationId(correlationId);
        message2.setCorrelationId(correlationId);
        message3.setCorrelationId(correlationId);

        InboundEndpoint endpoint = MuleTestUtils.getTestInboundEndpoint(MessageExchangePattern.ONE_WAY, muleContext);
        MuleEvent event1 = new DefaultMuleEvent(message1, endpoint, session);
        MuleEvent event2 = new DefaultMuleEvent(message2, endpoint, session);
        MuleEvent event3 = new DefaultMuleEvent(message3, endpoint, session);

        assertNull(router.process(event2));
        assertNull(router.process(event3));

        MuleEvent resultEvent = router.process(event1);
View Full Code Here

    protected MuleEvent createResultEvent(MuleEvent event, Object result) throws MuleException
    {
        if (result instanceof MuleMessage)
        {
            return new DefaultMuleEvent((MuleMessage) result, event);
        }
        else if (result != null)
        {
            event.getMessage().applyTransformers(
                event,
                Collections.<Transformer> singletonList(new TransformerTemplate(
                    new TransformerTemplate.OverwitePayloadCallback(result))));
            return event;
        }
        else
        {
            return new DefaultMuleEvent(new DefaultMuleMessage(NullPayload.getInstance(),
                event.getMuleContext()), event);
        }
    }
View Full Code Here

            }

            Object ackResponsePayload = muleContext.getExpressionManager().evaluate(ackExpression,
                event.getMessage());

            return new DefaultMuleEvent(new DefaultMuleMessage(ackResponsePayload, event.getMessage(),
                muleContext), event);
        }
        catch (Exception e)
        {
            throw new MessagingException(
View Full Code Here

        }
    }

    private DefaultMuleEvent threadSafeCopy(MuleEvent event)
    {
        return new DefaultMuleEvent(new DefaultMuleMessage(event.getMessage()), event);
    }
View Full Code Here

    protected MuleEvent createResultEvent(MuleEvent event, Object result) throws MuleException
    {
        if (result instanceof MuleMessage)
        {
            return new DefaultMuleEvent((MuleMessage) result, event);
        }
        else if (result instanceof VoidResult)
        {
            return event;
        }
        else if (result != null)
        {
            event.getMessage().applyTransformers(
                event,
                Collections.<Transformer> singletonList(new TransformerTemplate(
                    new TransformerTemplate.OverwitePayloadCallback(result))));
            return event;
        }
        else
        {
            return new DefaultMuleEvent(new DefaultMuleMessage(NullPayload.getInstance(), muleContext), event);
        }
    }
View Full Code Here

     * While the service isn't stopped this runs a continuous loop checking for new
     * events in the queue.
     */
    public void run()
    {
        DefaultMuleEvent event = null;
        QueueSession queueSession = muleContext.getQueueManager().getQueueSession();

        running.set(true);
        while (!lifecycleManager.getState().isStopped())
        {
            try
            {
                // Wait if the service is paused
                if (lifecycleManager.isPhaseComplete(Pausable.PHASE_NAME))
                {
                    waitIfPaused();

                    // If service is resumed as part of stopping
                    if (lifecycleManager.getState().isStopping())
                    {
                        if (!isQueuePersistent() && (queueSession != null && getQueueSize() > 0))
                        {
                            // Any messages in a non-persistent queue when paused
                            // service is stopped are lost
                            logger.warn(CoreMessages.stopPausedSedaStageNonPeristentQueueMessageLoss(
                                getQueueSize(), getQueueName()));
                        }
                        break;
                    }
                }

                // If we're doing a draining stop, read all events from the queue
                // before stopping
                if (lifecycleManager.getState().isStopping())
                {
                    if (isQueuePersistent() || queueSession == null || getQueueSize() <= 0)
                    {
                        break;
                    }
                }

                event = (DefaultMuleEvent) dequeue();
            }
            catch (InterruptedException ie)
            {
                break;
            }
            catch (Exception e)
            {
                muleContext.getExceptionListener().handleException(e);
            }

            if (event != null)
            {
                    if (isStatsEnabled())
                    {
                        queueStatistics.decQueuedEvent();
                    }

                    if (logger.isDebugEnabled())
                    {
                        logger.debug(MessageFormat.format("{0}: Dequeued event from {1}",
                            getStageDescription(), getQueueName()));
                    }
                    SedaStageWorker work = new SedaStageWorker(event);
                    if (doThreading)
                    {
                        try
                        {
                            // TODO Remove this thread handoff to ensure Zero Message Loss
                            workManagerSource.getWorkManager().scheduleWork(work, WorkManager.INDEFINITE, null,
                                new AsyncWorkListener(next));
                        }
                        catch (Exception e)
                        {
                            // This is a work manager exception, not a Mule event-related exception
                            event.getFlowConstruct().getExceptionListener().handleException(e, event);
                        }
                    }
                    else
                    {
                        try
                        {
                            work.doWork();
                        }
                        catch (MuleException e)
                        {
                            MessagingExceptionHandler exceptionListener = event.getFlowConstruct().getExceptionListener();
                            if (e instanceof MessagingException)
                            {
                                exceptionListener.handleException(e, event);
                            }
                            else
View Full Code Here

TOP

Related Classes of org.mule.DefaultMuleEvent$NullInboundEndpoint

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.