Package org.mule.api.exception

Examples of org.mule.api.exception.MessagingExceptionHandler


    private void validateDefaultExceptionStrategy()
    {
        String defaultExceptionStrategyName = config.getDefaultExceptionStrategyName();
        if (defaultExceptionStrategyName != null)
        {
            MessagingExceptionHandler messagingExceptionHandler = muleContext.getRegistry().lookupObject(
                defaultExceptionStrategyName);
            if (messagingExceptionHandler == null)
            {
                throw new MuleRuntimeException(CoreMessages.createStaticMessage(String.format(
                    "No global exception strategy defined with name %s.", defaultExceptionStrategyName)));
View Full Code Here


            {
                try
                {
                    try
                    {
                        final MessagingExceptionHandler exceptionHandler = messageProcessContext.getFlowConstruct().getExceptionListener();
                        TransactionalErrorHandlingExecutionTemplate transactionTemplate = TransactionalErrorHandlingExecutionTemplate.
                                createMainExecutionTemplate(messageProcessContext.getFlowConstruct().getMuleContext(),
                                                            (messageProcessContext.getTransactionConfig() == null ? new MuleTransactionConfig() : messageProcessContext.getTransactionConfig()),
                                                            exceptionHandler);
                        final MuleEvent response = transactionTemplate.execute(new ExecutionCallback<MuleEvent>()
View Full Code Here

        {
            ((Initialisable) chain).initialise();
        }
        if (chain instanceof MessagingExceptionHandlerAware)
        {
            MessagingExceptionHandler chainExceptionHandler = this.exceptionHandler;
            if (chainExceptionHandler == null)
            {
                chainExceptionHandler = flowContruct != null ? flowContruct.getExceptionListener() : null;
            }
            ((MessagingExceptionHandlerAware) chain).setMessagingExceptionHandler(chainExceptionHandler);
View Full Code Here

    private void addDefaultExceptionStrategyIfRequired() throws InitialisationException
    {
        if (!exceptionListeners.get(exceptionListeners.size() - 1).acceptsAll())
        {
            MessagingExceptionHandler defaultExceptionStrategy;
            try
            {
                defaultExceptionStrategy = getMuleContext().getDefaultExceptionStrategy();
            }
            catch (Exception e)
View Full Code Here

    private void validateOnlyOneHandlesRedelivery()
    {
        boolean rollbackWithRedelivery = false;
        for (int i = 0; i < exceptionListeners.size(); i++)
        {
            MessagingExceptionHandler messagingExceptionHandler = exceptionListeners.get(i);
            if (messagingExceptionHandler instanceof MessagingExceptionStrategyAcceptorDelegate)
            {
                messagingExceptionHandler = ((MessagingExceptionStrategyAcceptorDelegate) messagingExceptionHandler).getExceptionListener();
            }
            if (messagingExceptionHandler instanceof RollbackMessagingExceptionStrategy && ((RollbackMessagingExceptionStrategy) messagingExceptionHandler).hasMaxRedeliveryAttempts())
View Full Code Here

         flowConstruct should be responsible of redelivery policy use */
        AbstractRedeliveryPolicy redeliveryPolicy = super.getRedeliveryPolicy();
        RollbackMessagingExceptionStrategy rollbackMessagingExceptionStrategy = null;
        if (flowConstruct != null && flowConstruct.getExceptionListener() != null)
        {
            MessagingExceptionHandler exceptionListener = flowConstruct.getExceptionListener();
            if (exceptionListener instanceof RollbackMessagingExceptionStrategy)
            {
                rollbackMessagingExceptionStrategy = (RollbackMessagingExceptionStrategy) exceptionListener;
            }
            else if (exceptionListener instanceof ChoiceMessagingExceptionStrategy)
View Full Code Here

    public void testFlowAndServiceUseProperExceptionStrategy()
    {
        Set<MessagingExceptionHandler> usedExceptionStrategies = new HashSet<MessagingExceptionHandler>();

        Service serviceNoExceptionStrategy = muleContext.getRegistry().lookupService("serviceNoExceptionStrategy");
        MessagingExceptionHandler serviceNoExceptionStrategyExceptionListener = serviceNoExceptionStrategy.getExceptionListener();
        assertThat(serviceNoExceptionStrategyExceptionListener, instanceOf(CatchMessagingExceptionStrategy.class));
        usedExceptionStrategies.add(serviceNoExceptionStrategyExceptionListener);

        Service serviceExceptionStrategy = muleContext.getRegistry().lookupService("serviceExceptionStrategy");
        MessagingExceptionHandler serviceExceptionStrategyExceptionListener = serviceExceptionStrategy.getExceptionListener();
        assertThat(serviceExceptionStrategyExceptionListener, instanceOf(DefaultMessagingExceptionStrategy.class));
        assertThat(usedExceptionStrategies.add(serviceExceptionStrategyExceptionListener), is(true));

        Service serviceNoExceptionStrategyInModel = muleContext.getRegistry().lookupService("serviceNoExceptionStrategyInModel");
        MessagingExceptionHandler serviceNoExceptionStrategyInModelExceptionListener = serviceNoExceptionStrategyInModel.getExceptionListener();
        assertThat(serviceNoExceptionStrategyInModelExceptionListener, instanceOf(CustomExceptionStrategy.class));
        assertThat(usedExceptionStrategies.add(serviceNoExceptionStrategyInModelExceptionListener),is(true));

        FlowConstruct flowNoExceptionStrategy = muleContext.getRegistry().lookupFlowConstruct("flowNoExceptionStrategy");
        MessagingExceptionHandler flowNoExceptionStrategyExceptionListener = flowNoExceptionStrategy.getExceptionListener();
        assertThat(flowNoExceptionStrategyExceptionListener, instanceOf(CustomExceptionStrategy.class));
        assertThat(usedExceptionStrategies.add(flowNoExceptionStrategyExceptionListener),is(true));

        FlowConstruct flowExceptionStrategy = muleContext.getRegistry().lookupFlowConstruct("flowExceptionStrategy");
        MessagingExceptionHandler flowExceptionStrategyExceptionListener = flowExceptionStrategy.getExceptionListener();
        assertThat(flowExceptionStrategyExceptionListener, instanceOf(CatchMessagingExceptionStrategy.class));
        assertThat(usedExceptionStrategies.add(flowExceptionStrategyExceptionListener),is(true));

    }
View Full Code Here

    @Override
    public void testConnectorConfig() throws Exception
    {
        super.testConnectorConfig();

        MessagingExceptionHandler es = muleContext.getRegistry().lookupModel("main").getExceptionListener();
        assertNotNull(es);
        assertTrue(es.getClass().getName(), es instanceof TestExceptionStrategy);
    }
View Full Code Here

        ConfigurationBuilder configurationBuilder = new AutoConfigurationBuilder(
            "org/mule/test/spring/config1/test-xml-mule2-config.xml");
        configurationBuilder.configure(muleContext);

        // Just a few of the asserts from AbstractConfigBuilderTestCase
        MessagingExceptionHandler es = muleContext.getRegistry().lookupModel("main").getExceptionListener();
        assertNotNull(es);
        assertTrue(es instanceof TestExceptionStrategy);
    }
View Full Code Here

    }

    @Test
    public void testTwoFlowsReferencingSameExceptionStrategyGetDifferentInstances()
    {
        MessagingExceptionHandler firstExceptionStrategy = muleContext.getRegistry().lookupFlowConstruct("otherFlowWithSameReferencedExceptionStrategy").getExceptionListener();
        MessagingExceptionHandler secondExceptionStrategy = muleContext.getRegistry().lookupFlowConstruct("referenceExceptionStrategyFlow").getExceptionListener();
        assertThat(firstExceptionStrategy, IsNot.not(secondExceptionStrategy));
    }
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.