Package javax.jms

Examples of javax.jms.XAConnectionFactory


      {
         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

      if(!ServerManagement.isServerPeerStarted())
      {
         ServerManagement.startServerPeer();
      }
     
      XAConnectionFactory cf = (XAConnectionFactory)initialContext.lookup("/ConnectionFactory");
     
      ServerManagement.deployQueue("Queue");

      Queue queue = (Queue)initialContext.lookup("/queue/Queue");
     
      XAConnection conn = null;
     
      try
      {
         conn = cf.createXAConnection();
        
         Xid xid1, xid2;
        
         {
        
View Full Code Here

                }
            } catch (SQLException e) {
                throw new RuntimeException(e.getMessage());
            }

            XAConnectionFactory factory = AQjmsFactory.getXAConnectionFactory(xaDs);
            context.rebind(XA_CONNECTION_FACTORY, factory);
            context.rebind("KURTSTAM", new String("hello"));

            // create the connection factory
            ConnectionFactory connectionFactory = AQjmsFactory.getConnectionFactory(ds);
View Full Code Here

                        password = JmsUtil.getPasswordFromFile(password);
                    }
                   
                    if (isXAAware)
                    {
                        final XAConnectionFactory factory = (XAConnectionFactory)factoryConnection ;
                        jmsConnection = useJMSSecurity ? factory.createXAConnection(username,password): factory.createXAConnection();
                        freeSessionsMap.put(XA_TRANSACTED, new ArrayList<JmsSession>() );
                        inUseSessionsMap.put(XA_TRANSACTED, new ArrayList<JmsSession>() );
                    }
                    else if (factoryConnection instanceof ConnectionFactory)
                    {
                        final ConnectionFactory factory = (ConnectionFactory)factoryConnection ;
                        jmsConnection = useJMSSecurity ? factory.createConnection(username,password): factory.createConnection();
                    }
                    else
                    {
                        throw new ConnectionException("Unknown factory connection type: " + factoryConnection.getClass().getCanonicalName());
                    }
View Full Code Here

      // configured by default in jboss-service.xml

      ConnectionFactory cf = (ConnectionFactory)initialContext.lookup("/ConnectionFactory");
      log.debug("ConnectionFactory: " + cf);

      XAConnectionFactory xacf = (XAConnectionFactory)initialContext.lookup("/XAConnectionFactory");
      log.debug("ConnectionFactory: " + xacf);

      cf = (ConnectionFactory)initialContext.lookup("java:/ConnectionFactory");
      log.debug("ConnectionFactory: " + cf);
View Full Code Here

   public void testSimpleXAConnectionFailover() throws Exception
   {
      XAConnection conn = null;
     
      XAConnectionFactory xaCF = (XAConnectionFactory)cf;

      try
      {
         // skip connection to node 0
         conn = xaCF.createXAConnection();
         conn.close();

         // create a connection to node 1
         conn = xaCF.createXAConnection();
         conn.start();

         assertEquals(1, ((JBossConnection)conn).getServerID());

         // register a failover listener
View Full Code Here

   public void testSendFailBeforePrepare() throws Exception
   {
      XAConnection xaConn = null;
     
      XAConnectionFactory xaCF = (XAConnectionFactory)cf;
     
      Connection conn = null;
     
      try
      {
         // skip connection to node 0
         xaConn = xaCF.createXAConnection();
         xaConn.close();

         // create a connection to node 1
         xaConn = xaCF.createXAConnection();
        
         assertEquals(1, ((JBossConnection)xaConn).getServerID());

         conn = cf.createConnection();
         conn.close();
View Full Code Here

  
   public void testSendAndReceiveFailAfterPrepareAndRetryCommit() throws Exception
   {
      XAConnection xaConn1 = null;
     
      XAConnectionFactory xaCF = (XAConnectionFactory)cf;
     
      TextMessage sent1 = null;

      // Sending a messages
      {

         Connection conn1 = null;

         conn1 = cf.createConnection();

         assertEquals(0, ((JBossConnection)conn1).getServerID());

         conn1 = cf.createConnection();

         assertEquals(1, ((JBossConnection)conn1).getServerID());

         //Send a message
       
         Session sess = conn1.createSession(false, Session.AUTO_ACKNOWLEDGE);

         MessageProducer prod = sess.createProducer(queue[1]);

         sent1 = sess.createTextMessage("plop1");

         prod.send(sent1);

         conn1.close();
      }


      try
      {
         xaConn1 = xaCF.createXAConnection();
        
         assertEquals(0, ((JBossConnection)xaConn1).getServerID());

         xaConn1 = xaCF.createXAConnection();
        
         assertEquals(1, ((JBossConnection)xaConn1).getServerID());

         xaConn1.start();
                 
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.