Package org.mule.api.exception

Examples of org.mule.api.exception.MessagingExceptionHandler


    }

    @Test
    public void testTwoFlowsReferencingDifferentExceptionStrategy()
    {
        MessagingExceptionHandler firstExceptionStrategy = muleContext.getRegistry().lookupFlowConstruct("otherFlowWithSameReferencedExceptionStrategy").getExceptionListener();
        MessagingExceptionHandler secondExceptionStrategy = muleContext.getRegistry().lookupFlowConstruct("anotherFlowUsingDifferentExceptionStrategy").getExceptionListener();
        assertThat(firstExceptionStrategy, IsNot.not(secondExceptionStrategy));
        assertThat(((AbstractExceptionListener)firstExceptionStrategy).getMessageProcessors().size(), is(2));
        assertThat(secondExceptionStrategy, instanceOf(ChoiceMessagingExceptionStrategy.class));
    }
View Full Code Here



    @Test
    public void testConnectorConfig() throws Exception
    {
        MessagingExceptionHandler es = muleContext.getRegistry().lookupModel("main").getExceptionListener();
        assertNotNull(es);
        assertTrue(es.getClass().getName(), es instanceof TestExceptionStrategy);
    }
View Full Code Here

        TestConnector cnn = (TestConnector)muleContext.getRegistry().lookupConnector("customConnector");
        assertNotNull("customConnector should not be null", cnn);
        assertEquals(cnn.getSomeProperty(), "foo");

        //Test exception strategy
        MessagingExceptionHandler es = muleContext.getRegistry().lookupModel("main").getExceptionListener();
        assertNotNull(es);
        assertTrue(es instanceof TestExceptionStrategy);
        assertEquals("bar", ((TestExceptionStrategy) es).getTestProperty());
    }
View Full Code Here

    }

    @Override
    public MessagingExceptionHandler getDefaultExceptionStrategy()
    {
        MessagingExceptionHandler defaultExceptionStrategy;
        if (config.getDefaultExceptionStrategyName() != null)
        {
            defaultExceptionStrategy = getRegistry().lookupObject(config.getDefaultExceptionStrategyName());
            if (defaultExceptionStrategy == null)
            {
View Full Code Here

        }

        @Override
        protected void doRun()
        {
            MessagingExceptionHandler exceptionHandler = messagingExceptionHandler;
            ExecutionTemplate<MuleEvent> executionTemplate = TransactionalErrorHandlingExecutionTemplate.createMainExecutionTemplate(
                    muleContext, new MuleTransactionConfig(), exceptionHandler);

            try
            {
View Full Code Here

            });

            if (serviceName != null && !(serviceName.length() == 0))
            {
                muleContext.getRegistry().lookupService(serviceName).setExceptionListener(
                    new MessagingExceptionHandler()
                    {
                        @Override
                        public MuleEvent handleException(Exception e, MuleEvent event)
                        {
                            if (logger.isInfoEnabled()) logger.info("expected exception occurred: " + e, e);
View Full Code Here

                                                    String serviceName)
    {
        // Declare countdown latch and listener
        final CountDownLatch latch = new CountDownLatch(1);
        SystemExceptionHandler listener = null;
        MessagingExceptionHandler messagingListener = null;
        SystemExceptionHandler currentExceptionListener = null;
        MessagingExceptionHandler currentMessagingListener = null;
        final ValueHolder<Exception> exceptionHolder = new ValueHolder<Exception>();

        try
        {
            // Next create a listener that listens for exception on the
            // sftp-connector
            listener = new SystemExceptionHandler()
            {
                @Override
                public void handleException(Exception e, RollbackSourceCallback rollbackMethod)
                {
                    exceptionHolder.value = e;
                    if (logger.isDebugEnabled())
                        logger.debug("Expected exception occurred: " + e.getMessage()
                                     + ", time to countdown the latch");
                    latch.countDown();
                }

                @Override
                public void handleException(Exception exception)
                {
                    handleException(exception, null);
                }
            };

            messagingListener = new MessagingExceptionHandler()
            {
                @Override
                public MuleEvent handleException(Exception e, MuleEvent event)
                {
                    exceptionHolder.value = e;
View Full Code Here

            queueTimeout, threadingProfile, queueStatistics, muleContext);
        sedaStageInterceptingMessageProcessor.setListener(mockListener);
        sedaStageInterceptingMessageProcessor.initialise();
        sedaStageInterceptingMessageProcessor.start();

        MessagingExceptionHandler exceptionHandler = mock(MessagingExceptionHandler.class);
        Flow flow = mock(Flow.class);
        when(flow.getExceptionListener()).thenReturn(exceptionHandler);
        when(flow.getProcessingStrategy()).thenReturn(new AsynchronousProcessingStrategy());
        final MuleEvent event = getTestEvent(TEST_MESSAGE, flow, MessageExchangePattern.ONE_WAY);
View Full Code Here

            threadingProfile, queueStatistics, muleContext);
        sedaStageInterceptingMessageProcessor.setListener(mockListener);
        sedaStageInterceptingMessageProcessor.initialise();
        sedaStageInterceptingMessageProcessor.start();

        MessagingExceptionHandler exceptionHandler = mock(MessagingExceptionHandler.class);
        Flow flow = mock(Flow.class);
        when(flow.getExceptionListener()).thenReturn(exceptionHandler);
        when(flow.getProcessingStrategy()).thenReturn(new AsynchronousProcessingStrategy());
        final MuleEvent event = getTestEvent(TEST_MESSAGE, flow, MessageExchangePattern.ONE_WAY);
View Full Code Here

            queueProfile, queueTimeout, threadingProfile, queueStatistics, muleContext);
        sedaStageInterceptingMessageProcessor.setListener(mockListener);
        sedaStageInterceptingMessageProcessor.initialise();
        sedaStageInterceptingMessageProcessor.start();

        MessagingExceptionHandler exceptionHandler = mock(MessagingExceptionHandler.class);
        Flow flow = mock(Flow.class);
        when(flow.getExceptionListener()).thenReturn(exceptionHandler);
        when(flow.getProcessingStrategy()).thenReturn(new AsynchronousProcessingStrategy());
        MuleEvent event = getTestEvent(TEST_MESSAGE, flow, MessageExchangePattern.ONE_WAY);
View Full Code Here

TOP

Related Classes of org.mule.api.exception.MessagingExceptionHandler

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.