Package org.jboss.jms.client

Examples of org.jboss.jms.client.JBossSession


            }
         }
        
         if (forwardMode == FORWARD_MODE_XA && sourceSession instanceof JBossSession)
         {
           JBossSession jsession = (JBossSession)sourceSession;
          
           SessionState sstate = (SessionState)((DelegateSupport)jsession.getDelegate()).getState();
           
           sstate.setTreatAsNonTransactedWhenNotEnlisted(false);
         }
           
         if (subName == null)
View Full Code Here


      //If not XA then we use a client ack session for consuming - this allows us to get the message, send it to the destination
      //then ack the message.
      //This means that if a failure occurs between sending and acking the message won't be lost but may get delivered
      //twice - i.e we have dups_ok behaviour
     
      JBossSession sess = (JBossSession)sourceConnection.createSession(false, Session.CLIENT_ACKNOWLEDGE);
   
      sourceSession = (SessionDelegate)sess.getDelegate();
           
      sess = (JBossSession)localConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
     
      localSession = (SessionDelegate)sess.getDelegate();
    }
    else
    {
      JBossSession sess = (JBossSession)sourceConnection.createXASession();
     
      sourceSession = (SessionDelegate)sess.getDelegate();
     
      sess = (JBossSession)localConnection.createXASession();
     
      localSession = (SessionDelegate)sess.getDelegate();
    }
           
    JBossDestination dest = new JBossQueue(localQueue.getName(), true);
       
    producer = localSession.createProducerDelegate(dest);
View Full Code Here

     
      try
      {       
        conn = cf.createConnection();
       
        JBossSession sess = (JBossSession)conn.createSession(false, Session.DUPS_OK_ACKNOWLEDGE);
       
        ClientSessionDelegate del = (ClientSessionDelegate)sess.getDelegate();
       
        assertEquals(1000, del.getDupsOKBatchSize());
      }
      finally
      {
View Full Code Here

         ConnectionState state = (ConnectionState)del.getState();

         ResourceManager rm = state.getResourceManager();

         // Create a session
         JBossSession sess1 = (JBossSession)conn.createXASession();
         DummyListener listener = new DummyListener();
         sess1.setMessageListener(listener);
         conn.start();
         MessagingXAResource res1 = (MessagingXAResource)sess1.getXAResource();
         tm.begin();

         Transaction trans = tm.getTransaction();
         trans.enlistResource(res1);
         trans.delistResource(res1, XAResource.TMSUCCESS);
         MessageProducer p = sess1.createProducer(queue1);
         MessageConsumer cons = sess1.createConsumer(queue1);
         conn.start();
         // send 10 messages
         for (int i = 0; i < 10; i++)
         {
            TextMessage message = sess1.createTextMessage("delistedwork" + i);
            p.send(message);
         }
         // now receive 5
         for (int i = 0; i < 5; i++)
         {
            TextMessage textMessage = (TextMessage)cons.receive();
            assertEquals("delistedwork" + i, textMessage.getText());
         }
         // once we enlist ensure that the 5 acks are merged ok, the first timne we do this there is nothing to merge in
         // the global tx
         // so all acks are just copied
         trans.enlistResource(res1);
         SessionState sstate = (SessionState)((DelegateSupport)sess1.getDelegate()).getState();
         ClientTransaction clientTransaction = rm.getTx(sstate.getCurrentTxId());
         assertEquals("to many session states", clientTransaction.getSessionStates().size(), 1);
         ClientTransaction.SessionTxState sessionTxState = (ClientTransaction.SessionTxState)clientTransaction.getSessionStates()
                                                                                                              .get(0);
         assertEquals("wrong number of acks", 5, sessionTxState.getAcks().size());
View Full Code Here

         // Starts a new transaction
         tm.begin();

         Transaction trans = tm.getTransaction();

         JBossSession session = (JBossSession)xasession;
         SessionState state = (SessionState)((DelegateSupport)session.getDelegate()).getState();

         // Validates TX convertion
         assertTrue(state.getCurrentTxId() instanceof LocalTx);

         // Enlist the transaction... as supposed to be happening on JBossAS with the
View Full Code Here

         ConnectionState state = (ConnectionState)del.getState();

         ResourceManager rm = state.getResourceManager();

         // Create a session
         JBossSession sess1 = (JBossSession)conn.createXASession();
         DummyListener listener = new DummyListener();
         sess1.setMessageListener(listener);
         conn.start();
         MessagingXAResource res1 = (MessagingXAResource)sess1.getXAResource();
         tm.begin();

         Transaction trans = tm.getTransaction();
         trans.enlistResource(res1);
         trans.delistResource(res1, XAResource.TMSUCCESS);
         MessageProducer p = sess1.createProducer(queue1);
         MessageConsumer cons = sess1.createConsumer(queue1);
         conn.start();
         // send 10 messages
         for (int i = 0; i < 10; i++)
         {
            TextMessage message = sess1.createTextMessage("delistedwork" + i);
            p.send(message);
         }
         // now receive 5
         for (int i = 0; i < 5; i++)
         {
            TextMessage textMessage = (TextMessage)cons.receive();
            assertEquals("delistedwork" + i, textMessage.getText());
         }
         // once we enlist ensure that the 5 acks are merged ok, the first timne we do this there is nothing to merge in
         // the global tx
         // so all acks are just copied
         trans.enlistResource(res1);
         SessionState sstate = (SessionState)((DelegateSupport)sess1.getDelegate()).getState();
         ClientTransaction clientTransaction = rm.getTx(sstate.getCurrentTxId());
         assertEquals("to many session states", clientTransaction.getSessionStates().size(), 1);
         ClientTransaction.SessionTxState sessionTxState = (ClientTransaction.SessionTxState)clientTransaction.getSessionStates()
                                                                                                              .get(0);
         assertEquals("wrong number of acks", 5, sessionTxState.getAcks().size());
View Full Code Here

         // Starts a new transaction
         tm.begin();

         Transaction trans = tm.getTransaction();

         JBossSession session = (JBossSession)xasession;
         SessionState state = (SessionState)((DelegateSupport)session.getDelegate()).getState();

         // Validates TX convertion
         assertTrue(state.getCurrentTxId() instanceof LocalTx);

         // Enlist the transaction... as supposed to be happening on JBossAS with the
View Full Code Here

            }
         }
        
         if (forwardMode == FORWARD_MODE_XA && sourceSession instanceof JBossSession)
         {
           JBossSession jsession = (JBossSession)sourceSession;
          
           SessionState sstate = (SessionState)((DelegateSupport)jsession.getDelegate()).getState();
           
           sstate.setTreatAsNonTransactedWhenNotEnlisted(false);
         }
           
         if (subName == null)
View Full Code Here

      //If not XA then we use a client ack session for consuming - this allows us to get the message, send it to the destination
      //then ack the message.
      //This means that if a failure occurs between sending and acking the message won't be lost but may get delivered
      //twice - i.e we have dups_ok behaviour
     
      JBossSession sess = (JBossSession)sourceConnection.createSession(false, Session.CLIENT_ACKNOWLEDGE);
   
      sourceSession = (SessionDelegate)sess.getDelegate();
           
      sess = (JBossSession)localConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
     
      localSession = (SessionDelegate)sess.getDelegate();
    }
    else
    {
      JBossSession sess = (JBossSession)sourceConnection.createXASession();
     
      sourceSession = (SessionDelegate)sess.getDelegate();
     
      sess = (JBossSession)localConnection.createXASession();
     
      localSession = (SessionDelegate)sess.getDelegate();
    }
           
    JBossDestination dest = new JBossQueue(localQueue.getName(), true);
       
    producer = localSession.createProducerDelegate(dest);
View Full Code Here

            }
         }
        
         if (forwardMode == FORWARD_MODE_XA && sourceSession instanceof JBossSession)
         {
           JBossSession jsession = (JBossSession)sourceSession;
          
           SessionState sstate = (SessionState)((DelegateSupport)jsession.getDelegate()).getState();
           
           sstate.setTreatAsNonTransactedWhenNotEnlisted(false);
         }
           
         if (subName == null)
View Full Code Here

TOP

Related Classes of org.jboss.jms.client.JBossSession

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.