Package javax.jms

Examples of javax.jms.XAConnectionFactory


      InitialContext ic = null;
      try
      {
         ic = new InitialContext(icProp);
     
         XAConnectionFactory xaFact = (XAConnectionFactory)ic.lookup("/XAConnectionFactory");
     
         return xaFact;
      }
      finally
      {
View Full Code Here


         suspended = TransactionManagerLocator.getInstance().locate().suspend();

         // send a message to the queue using an XASession that's not enlisted in a global tx

         XAConnectionFactory xcf = (XAConnectionFactory)cf;

         XAConnection xconn = xcf.createXAConnection();

         XASession xs = xconn.createXASession();

         MessageProducer p = xs.createProducer(queue1);
         Message m = xs.createTextMessage("one");
View Full Code Here

         Integer count = (Integer)ServerManagement.getAttribute(queueMBean, "MessageCount");
         assertEquals(1, count.intValue());

         // using XA with a ConnectionConsumer (testing the transaction behavior under MDBs)

         XAConnectionFactory xacf = (XAConnectionFactory)cf;
         xaconn = xacf.createXAConnection();
         xaconn.start();
         XASession xasession = xaconn.createXASession();
         DummyListener listener = new DummyListener();
         xasession.setMessageListener(listener);
View Full Code Here

      {
         ObjectName queueMBean = new ObjectName("jboss.messaging.destination:service=Queue,name=Queue1");
         Integer count = (Integer)ServerManagement.getAttribute(queueMBean, "MessageCount");
         assertEquals(1, count.intValue());

         XAConnectionFactory xcf = (XAConnectionFactory)cf;
         XAConnection xconn = xcf.createXAConnection();
         xconn.start();

         // no active JTA transaction here

         XASession xs = xconn.createXASession();
View Full Code Here

         tm.begin();

         Transaction trans = tm.getTransaction();

         XAConnectionFactory xacf = (XAConnectionFactory)cf;

         xaconn = xacf.createXAConnection();

         xaconn.start();

         XASession xasession = xaconn.createXASession();
View Full Code Here

         ObjectName queueMBean = new ObjectName("jboss.messaging.destination:service=Queue,name=Queue1");
         Integer count = (Integer)ServerManagement.getAttribute(queueMBean, "MessageCount");
         assertEquals(2, count.intValue());

         XAConnectionFactory xacf = (XAConnectionFactory)cf;

         xaconn = xacf.createXAConnection();

         xaconn.start();

         XASession xasession = xaconn.createXASession();
View Full Code Here

        Object preliminaryObject = lookup(ctx, connectionFactory, Object.class);
        log.debug("Got connection factory " + preliminaryObject + " from " + connectionFactory);
        log.debug("Attempting to create connection with user " + user);
        Connection result;
        if (preliminaryObject instanceof XAConnectionFactory && isDeliveryTransacted) {
            XAConnectionFactory xagcf = (XAConnectionFactory) preliminaryObject;
            if (user != null) {
                result = xagcf.createXAConnection(user, pass);
            } else {
                result = xagcf.createXAConnection();
            }
        } else {
           ConnectionFactory gcf = (ConnectionFactory) preliminaryObject;
            if (user != null) {
                result = gcf.createConnection(user, pass);
View Full Code Here

        log.debug("using username/password: " + String.valueOf(username) + "/-- not shown --");

        Connection connection = null;

        if (factory instanceof XAConnectionFactory) {
            XAConnectionFactory qFactory = (XAConnectionFactory) factory;

            if (username != null) {
                if (mcf.getProperties().getType() == JmsConnectionFactory.QUEUE) {
                    connection = ((XAQueueConnectionFactory)qFactory).createXAQueueConnection(username, password);
                } else if (mcf.getProperties().getType() == JmsConnectionFactory.TOPIC) {
                    connection = ((XATopicConnectionFactory)qFactory).createXATopicConnection(username, password);
                } else {
                    connection = qFactory.createXAConnection(username, password);
                }
            } else {
                if (mcf.getProperties().getType() == JmsConnectionFactory.QUEUE) {
                    connection = ((XAQueueConnectionFactory)qFactory).createXAQueueConnection();
                } else if (mcf.getProperties().getType() == JmsConnectionFactory.TOPIC) {
                    connection = ((XATopicConnectionFactory)qFactory).createXATopicConnection();
                } else {
                    connection = qFactory.createXAConnection();
                }
            }

            log.debug("created XAConnection: " + connection);
        } else if (factory instanceof ConnectionFactory) {
            ConnectionFactory qFactory = (ConnectionFactory) factory;
            if (username != null) {
                if (mcf.getProperties().getType() == JmsConnectionFactory.QUEUE) {
                    connection = ((QueueConnectionFactory)qFactory).createQueueConnection(username, password);
                } else if (mcf.getProperties().getType() == JmsConnectionFactory.TOPIC) {
                    connection = ((TopicConnectionFactory)qFactory).createTopicConnection(username, password);
                } else {
                    connection = qFactory.createConnection(username, password);
                }
            } else {
               if (mcf.getProperties().getType() == JmsConnectionFactory.QUEUE) {
                   connection = ((QueueConnectionFactory)qFactory).createQueueConnection();
               } else if (mcf.getProperties().getType() == JmsConnectionFactory.TOPIC) {
                   connection = ((TopicConnectionFactory)qFactory).createTopicConnection();
               } else {
                   connection = qFactory.createConnection();
               }
            }

            log.debug("created " + mcf.getProperties().getSessionDefaultType() + " connection: " + connection);
        } else {
View Full Code Here

        Object preliminaryObject = lookup(ctx, connectionFactory, Object.class);
        log.debug("Got connection factory " + preliminaryObject + " from " + connectionFactory);
        log.debug("Attempting to create connection with user " + user);
        Connection result;
        if (preliminaryObject instanceof XAConnectionFactory && isDeliveryTransacted) {
            XAConnectionFactory xagcf = (XAConnectionFactory) preliminaryObject;
            if (user != null) {
                result = xagcf.createXAConnection(user, pass);
            } else {
                result = xagcf.createXAConnection();
            }
        } else {
           ConnectionFactory gcf = (ConnectionFactory) preliminaryObject;
            if (user != null) {
                result = gcf.createConnection(user, pass);
View Full Code Here

         // Step 2. Lookup on the queue
         Queue queue = (Queue)initialContext.lookup("/queue/exampleQueue");

         // Step 3. Perform a lookup on the XA Connection Factory
         XAConnectionFactory cf = (XAConnectionFactory)initialContext.lookup("/XAConnectionFactory");

         // Step 4.Create a JMS XAConnection
         connection = cf.createXAConnection();

         // Step 5. Start the connection
         connection.start();

         // Step 6. Create a JMS XASession
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.