Package org.mule.transaction

Examples of org.mule.transaction.MuleTransactionConfig


    }

    protected void emptyReplyQueue() throws Exception
    {
        final MuleClient client = new MuleClient(muleContext);
        MuleTransactionConfig tc = new MuleTransactionConfig(TransactionConfig.ACTION_ALWAYS_BEGIN);
        tc.setFactory(new JmsTransactionFactory());
        ExecutionTemplate<Void> executionTemplate = TransactionalExecutionTemplate.createTransactionalExecutionTemplate(muleContext, tc);
        executionTemplate.execute(new ExecutionCallback<Void>()
        {
            public Void process() throws Exception
            {
View Full Code Here


        while (client.request("jms://replyTo.queue", 2000) != null)
        {
            // slurp
        }

        MuleTransactionConfig tc = new MuleTransactionConfig(TransactionConfig.ACTION_ALWAYS_BEGIN);
        tc.setFactory(new JmsTransactionFactory());

        // This enpoint needs to be registered prior to use cause we need to set
        // the transaction config so that the endpoint will "know" it is transacted
        // and not close the session itself but leave it up to the transaction.
        EndpointBuilder endpointBuilder = new EndpointURIEndpointBuilder(
View Full Code Here

        ((AbstractService) service).setExceptionListener(new DefaultMessagingExceptionStrategy(muleContext));
        service.setName("testComponent");
        service.setComponent(new DefaultJavaComponent(new PrototypeObjectFactory(JdbcFunctionalTestComponent.class)));

        TransactionFactory tf = getTransactionFactory();
        TransactionConfig txConfig = new MuleTransactionConfig(txBeginAction);
        txConfig.setFactory(tf);
       
        EndpointBuilder endpointBuilder = new EndpointURIEndpointBuilder(getInDest(), muleContext);
        endpointBuilder.setName("testIn");
        endpointBuilder.setConnector(connector);
        endpointBuilder.setTransactionConfig(txConfig);
View Full Code Here

public class MuleTransactionConfigTestCase extends AbstractMuleContextTestCase
{
    @Test
    public void testActionAndStringConversion()
    {
        MuleTransactionConfig c = new MuleTransactionConfig();
        c.setMuleContext(muleContext);

        c.setAction(MuleTransactionConfig.ACTION_ALWAYS_BEGIN);
        assertEquals(MuleTransactionConfig.ACTION_ALWAYS_BEGIN_STRING, c.getActionAsString());

        c.setAction(MuleTransactionConfig.ACTION_ALWAYS_JOIN);
        assertEquals(MuleTransactionConfig.ACTION_ALWAYS_JOIN_STRING, c.getActionAsString());

        c.setAction(MuleTransactionConfig.ACTION_BEGIN_OR_JOIN);
        assertEquals(MuleTransactionConfig.ACTION_BEGIN_OR_JOIN_STRING, c.getActionAsString());

        c.setAction(MuleTransactionConfig.ACTION_JOIN_IF_POSSIBLE);
        assertEquals(MuleTransactionConfig.ACTION_JOIN_IF_POSSIBLE_STRING, c.getActionAsString());

        c.setAction(MuleTransactionConfig.ACTION_NONE);
        assertEquals(MuleTransactionConfig.ACTION_NONE_STRING, c.getActionAsString());

        c.setAction(MuleTransactionConfig.ACTION_INDIFFERENT);
        assertEquals(MuleTransactionConfig.ACTION_INDIFFERENT_STRING, c.getActionAsString());
    }
View Full Code Here

        assertEquals(MuleTransactionConfig.ACTION_INDIFFERENT_STRING, c.getActionAsString());
    }

    @Test
    public void testDefaults() throws Exception {
        MuleTransactionConfig c = new MuleTransactionConfig(TransactionConfig.ACTION_ALWAYS_BEGIN);
        c.setMuleContext(muleContext);
        assertEquals("Wrong default TX timeout", 30000, c.getTimeout());
    }
View Full Code Here

    }

    @Test
    public void testTransactionJoinIfPossible() throws TransactionException
    {     
        MuleTransactionConfig txConfig = new MuleTransactionConfig(TransactionConfig.ACTION_JOIN_IF_POSSIBLE);
        txConfig.setMuleContext(muleContext);
        txConfig.setFactory(new TestTransactionFactory());
        assertFalse(txConfig.isTransacted());
    }
View Full Code Here

    }

    @Test
    public void testFailNoFactory()
    {
        MuleTransactionConfig txConfig = new MuleTransactionConfig(TransactionConfig.ACTION_ALWAYS_BEGIN);
        txConfig.setMuleContext(muleContext);
        // note how we don't set a factory here so the default in MTC is null
       
        try
        {
            txConfig.isTransacted();
            fail("isTransacted() must fail if no factory is set");
        }
        catch (RuntimeException re)
        {
            // this was expected
View Full Code Here

                    executionTemplate = TransactionalErrorHandlingExecutionTemplate.createMainExecutionTemplate(muleContext, endpoint.getTransactionConfig(), receiver.getFlowConstruct().getExceptionListener());
                }
                else
                {
                    // a simple inline endpoint
                    executionTemplate = TransactionalErrorHandlingExecutionTemplate.createMainExecutionTemplate(muleContext, new MuleTransactionConfig(), receiver.getFlowConstruct().getExceptionListener());
                }
            }
            else
            {
                executionTemplate = TransactionalErrorHandlingExecutionTemplate.createMainExecutionTemplate(muleContext, endpoint.getTransactionConfig(), receiver.getFlowConstruct().getExceptionListener());
View Full Code Here

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

            try
            {
                executionTemplate.execute(new ExecutionCallback<MuleEvent>()
                {
View Full Code Here

    @Test
    public void testActionNoneAndXaTxAndFailureInCallback() throws Exception
    {
        mockTransaction.setXA(true);
        TransactionCoordination.getInstance().bindTransaction(mockTransaction);
        MuleTransactionConfig config = new MuleTransactionConfig(TransactionConfig.ACTION_NONE);
        ExecutionTemplate executionTemplate = createExecutionTemplate(config);
        MuleEvent mockExceptionListenerResultEvent = configureExceptionListenerCall();
        try
        {
            executionTemplate.execute(getFailureTransactionCallback());
View Full Code Here

TOP

Related Classes of org.mule.transaction.MuleTransactionConfig

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.