Package javax.jms

Examples of javax.jms.XAConnectionFactory


        final Map headers = command.getHeaders();
        String login = (String) headers.get(Stomp.Headers.Connect.LOGIN);
        String passcode = (String) headers.get(Stomp.Headers.Connect.PASSCODE);
        String clientId = (String) headers.get(Stomp.Headers.Connect.CLIENT_ID);

        XAConnectionFactory factory = getConnectionFactory();
        IntrospectionSupport.setProperties(factory, headers, "factory.");

        if (login != null) {
            connection = factory.createXAConnection(login, passcode);
        }
        else {
            connection = factory.createXAConnection();
        }
        if (clientId != null) {
            connection.setClientID(clientId);
        }
        IntrospectionSupport.setProperties(connection, headers, "connection.");
View Full Code Here


     * Test with multiple XAResources originating from the same connection factory. XAResource(s) will be equal,
     * as they originate from the same session.
     */
    public void testIsSameRMSingleCF() throws Exception
    {
        XAConnectionFactory factory = getConnectionFactory(FACTORY_NAME);
        XAConnection conn = factory.createXAConnection();
        XASession session = conn.createXASession();
        XAResource xaResource1 = session.getXAResource();
        XAResource xaResource2 = session.getXAResource();
       
        assertEquals("XAResource objects not equal", xaResource1, xaResource2);
View Full Code Here

     */
    public void testIsSameRMMultiCF() throws Exception
    {
        startBroker(FAILING_PORT);
        ConnectionURL url = getConnectionFactory(FACTORY_NAME).getConnectionURL();
        XAConnectionFactory factory = new AMQConnectionFactory(url);
        XAConnectionFactory factory2 = new AMQConnectionFactory(url);
        XAConnectionFactory factory3 = getConnectionFactory(ALT_FACTORY_NAME);
       
        XAConnection conn = factory.createXAConnection();
        XAConnection conn2 = factory2.createXAConnection();
        XAConnection conn3 = factory3.createXAConnection();
       
        XASession session = conn.createXASession();
        XASession session2 = conn2.createXASession();
        XASession session3 = conn3.createXASession();

View Full Code Here

    {
    }

    public void testIsSameRMJoin() throws Exception
    {
        XAConnectionFactory factory = getConnectionFactory(FACTORY_NAME);
        XAConnection conn1 = factory.createXAConnection("guest", "guest");
        XAConnection conn2 = factory.createXAConnection("guest", "guest");
        XAConnection conn3 = factory.createXAConnection("guest", "guest");

        XASession session1 = conn1.createXASession();
        XASession session2 = conn2.createXASession();
        XASession session3 = conn3.createXASession();
View Full Code Here

     * Test with multiple XAResources originating from the same connection factory. XAResource(s) will be equal,
     * as they originate from the same session.
     */
    public void testIsSameRMSingleCF() throws Exception
    {
        XAConnectionFactory factory = getConnectionFactory(FACTORY_NAME);
        XAConnection conn = factory.createXAConnection("guest","guest");
        XASession session = conn.createXASession();
        XAResource xaResource1 = session.getXAResource();
        XAResource xaResource2 = session.getXAResource();

        assertEquals("XAResource objects not equal", xaResource1, xaResource2);
View Full Code Here

     */
    public void testIsSameRMMultiCF() throws Exception
    {
        startBroker(FAILING_PORT);
        ConnectionURL url = getConnectionFactory(FACTORY_NAME).getConnectionURL();
        XAConnectionFactory factory = new AMQConnectionFactory(url);
        XAConnectionFactory factory2 = new AMQConnectionFactory(url);
        XAConnectionFactory factory3 = getConnectionFactory(ALT_FACTORY_NAME);

        XAConnection conn = factory.createXAConnection("guest","guest");
        XAConnection conn2 = factory2.createXAConnection("guest","guest");
        XAConnection conn3 = factory3.createXAConnection("guest","guest");

        XASession session = conn.createXASession();
        XASession session2 = conn2.createXASession();
        XASession session3 = conn3.createXASession();

View Full Code Here

        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

        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

    }

    public XAStatefulHolder createPooledConnection(Object xaFactory, ResourceBean bean) throws Exception {
        if (!(xaFactory instanceof XAConnectionFactory))
            throw new IllegalArgumentException("class '" + xaFactory.getClass().getName() + "' does not implement " + XAConnectionFactory.class.getName());
        XAConnectionFactory xaConnectionFactory = (XAConnectionFactory) xaFactory;

        XAConnection xaConnection;
        if (user == null || password == null) {
            if (log.isDebugEnabled()) { log.debug("creating new JMS XAConnection with no credentials"); }
            xaConnection = xaConnectionFactory.createXAConnection();
        }
        else {
            if (log.isDebugEnabled()) { log.debug("creating new JMS XAConnection with user <" + user + "> and password <" + password + ">"); }
            xaConnection = xaConnectionFactory.createXAConnection(user, password);
        }

        JmsPooledConnection jmsPooledConnection = new JmsPooledConnection(this, xaConnection);
        xaStatefulHolders.add(jmsPooledConnection);
        return jmsPooledConnection;
View Full Code Here

         // Step 2. Lookup the Transaction Manager
         TransactionManager tm = (TransactionManager)ic.lookup("java:/TransactionManager");

         // Step 3. Look up the XA Connection Factory
         XAConnectionFactory xacf = (XAConnectionFactory)ic.lookup("java:/XAConnectionFactory");

         // Step 4. Look up the Queue
         Queue queue = (Queue)ic.lookup("queue/testQueue");

         // Step 5. Create a XA connection, a XA session and a message producer for the queue
         xaConnection = xacf.createXAConnection();
         XASession session = xaConnection.createXASession();
         MessageProducer messageProducer = session.createProducer(queue);

         // Step 6. Create a "fake" XAResource which will crash the server in its commit phase
         XAResource failingXAResource = new FailingXAResource();
View Full Code Here

TOP

Related Classes of javax.jms.XAConnectionFactory

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.