Package javax.jms

Examples of javax.jms.XAConnectionFactory


         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

                    rm.getResourceName() != null && !"".equals(rm.getResourceName());
        }

        public static boolean recover(final GenericResourceManager rm) throws IOException {
            if (isRecoverable(rm)) {
                final XAConnectionFactory connFactory = (XAConnectionFactory) rm.getConnectionFactory();

                RecoverableTransactionManager rtxManager = (RecoverableTransactionManager) rm.getTransactionManager();
                rtxManager.registerNamedXAResourceFactory(new NamedXAResourceFactory() {

                    @Override
                    public String getName() {
                        return rm.getResourceName();
                    }

                    @Override
                    public NamedXAResource getNamedXAResource() throws SystemException {
                        try {
                            final XAConnection xaConnection = connFactory.createXAConnection(rm.getUserName(), rm.getPassword());
                            final XASession session = xaConnection.createXASession();
                            xaConnection.start();
                            LOGGER.debug("new namedXAResource's connection: " + xaConnection);

                            return new ConnectionAndWrapperNamedXAResource(session.getXAResource(), getName(), xaConnection);
View Full Code Here

/*  69 */     log.debug("using connection factory: " + factory);
/*  70 */     log.debug("using username/password: " + String.valueOf(username) + "/-- not shown --");
/*     */
/*  74 */     if ((factory instanceof XAConnectionFactory))
/*     */     {
/*  76 */       XAConnectionFactory qFactory = (XAConnectionFactory)factory;
/*     */       Connection connection;
/*     */       Connection connection;
/*  77 */       if (username != null)
/*  78 */         connection = qFactory.createXAConnection(username, password);
/*     */       else {
/*  80 */         connection = qFactory.createXAConnection();
/*     */       }
/*  82 */       log.debug("created XAConnection: " + connection);
/*     */     }
/*  84 */     else if ((factory instanceof ConnectionFactory))
/*     */     {
/*  86 */       ConnectionFactory qFactory = (ConnectionFactory)factory;
/*     */       Connection connection;
/*     */       Connection connection;
/*  87 */       if (username != null)
/*  88 */         connection = qFactory.createConnection(username, password);
/*     */       else {
/*  90 */         connection = qFactory.createConnection();
/*     */       }
/*  92 */       log.debug("created Connection: " + connection);
/*     */     }
/*     */     else
/*     */     {
View Full Code Here

/*     */     {
/* 323 */       localXAConnectionFactory = (XAConnectionFactory)Util.lookup(ctx, connectionFactoryRef, XAConnectionFactory.class);
/*     */     }
/*     */     finally
/*     */     {
/*     */       XAConnectionFactory localXAConnectionFactory;
/* 327 */       ctx.close();
/*     */     }
/*     */   }
View Full Code Here

/*     */     }
/*     */
/* 351 */     ctx = adapter.getInitialContext();
/*     */     try
/*     */     {
/* 354 */       XAConnectionFactory localXAConnectionFactory = (XAConnectionFactory)Util.lookup(ctx, connectionFactoryRef, XAConnectionFactory.class);
/*     */       return localXAConnectionFactory;
/*     */     }
/*     */     finally
/*     */     {
/* 358 */       ctx.close();
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.