Package org.apache.qpid.client

Examples of org.apache.qpid.client.AMQXAResource


        XASession session1 = conn1.createXASession();
        XASession session2 = conn2.createXASession();
        XASession session3 = conn3.createXASession();

        AMQXAResource xaResource1 = (AMQXAResource)session1.getXAResource();
        AMQXAResource xaResource2 = (AMQXAResource)session2.getXAResource();
        AMQXAResource xaResource3 = (AMQXAResource)session3.getXAResource();

        Xid xid = getNewXid();

        xaResource1.start(xid, XAResource.TMNOFLAGS);
        assertTrue("XAResource isSameRM", xaResource1.isSameRM(xaResource2));
        xaResource2.start(xid, XAResource.TMJOIN);
        assertTrue("AMQXAResource siblings should be 1", xaResource1.getSiblings().size() == 1);

        assertTrue("AMQXAResource TMJOIN resource siblings should be 0", xaResource2.getSiblings().size() == 0);

        assertTrue("XAResource isSameRM", xaResource2.isSameRM(xaResource3));


        xaResource3.start(xid, XAResource.TMJOIN);
        assertTrue("AMQXAResource siblings should be 1", xaResource2.getSiblings().size() == 1);

        xaResource1.end(xid, XAResource.TMSUCCESS);
        assertTrue("AMQXAResource TMJOIN resource siblings should be 0", xaResource1.getSiblings().size() == 0);
View Full Code Here


        QpidResourceAdapter ra = new QpidResourceAdapter();
        QpidRAManagedConnectionFactory mcf = new QpidRAManagedConnectionFactory();
        mcf.setConnectionURL(URL);
        mcf.setResourceAdapter(ra);
        QpidRAManagedConnection mc = (QpidRAManagedConnection)mcf.createManagedConnection(null, null);
        AMQXAResource xa1 = (AMQXAResource)mc.getXAResource();

        XAConnectionFactory factory = getConnectionFactory(FACTORY_NAME);
        XAConnection connection = factory.createXAConnection("guest", "guest");
        XASession s2 = connection.createXASession();
        AMQXAResource xaResource = (AMQXAResource)connection.createXASession().getXAResource();

        assertTrue("QpidRAXAResource and XAResource should be from the same RM", xa1.isSameRM(xaResource));
        assertTrue("XAResource and QpidRAXAResource should be from the same RM", xaResource.isSameRM(xa1));

    }
View Full Code Here

        QpidResourceAdapter ra = new QpidResourceAdapter();
        QpidRAManagedConnectionFactory mcf = new QpidRAManagedConnectionFactory();
        mcf.setConnectionURL(URL);
        mcf.setResourceAdapter(ra);
        QpidRAManagedConnection mc = (QpidRAManagedConnection)mcf.createManagedConnection(null, null);
        AMQXAResource xa1 = (AMQXAResource)mc.getXAResource();

        XAConnectionFactory factory = getConnectionFactory(FACTORY_NAME);
        XAConnection connection = factory.createXAConnection("guest", "guest");
        XASession s2 = connection.createXASession();
        AMQXAResource xaResource = (AMQXAResource)connection.createXASession().getXAResource();

        assertTrue("QpidRAXAResource and XAResource should be from the same RM", xa1.isSameRM(xaResource));
        assertTrue("XAResource and QpidRAXAResource should be from the same RM", xaResource.isSameRM(xa1));

    }
View Full Code Here

TOP

Related Classes of org.apache.qpid.client.AMQXAResource

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.