Package javax.jms

Examples of javax.jms.Session.commit()


            for (int i = 0; i < 20; i++)
            {
               p.send(s.createTextMessage("message " + i));
            }

            s.commit();

            Session s2 = conn2.createSession(true, Session.AUTO_ACKNOWLEDGE);

            // these next three lines are an anti-pattern but they shouldn't loose any messages
            MessageConsumer c2 = s2.createConsumer(queue);
View Full Code Here


            // rollback methods are used to demarcate a transaction local to the session. In the
            // case where a session's work is coordinated by an external transaction manager, a
            // session's commit and rollback methods are not used and the result of a closed
            // session's work is determined later by the transaction manager.

            s2.commit();

            assertNull(c2.receive(1000));
         }
         finally
         {
View Full Code Here

      catch (javax.jms.IllegalStateException e)
      {}
     
      try
      {
         sess.commit();
         fail();
      }
      catch (javax.jms.IllegalStateException e)
      {}
     
View Full Code Here

      conn.start();

      TextMessage rm = (TextMessage)cons.receive();
      assertEquals("one", rm.getText());

      session.commit();

      conn.close();
   }

   public void test_Asynchronous_to_Client() throws Exception
View Full Code Here

        
         prod.send(msg);
        
         session1.close();
        
         session2.commit();
      }
      finally
      {
         if (conn != null)
         {
View Full Code Here

      Connection conn = cf.createConnection();     
      conn.start();
      Session sess = conn.createSession(true, Session.SESSION_TRANSACTED);
      MessageProducer prod = sess.createProducer(queue);
      prod.send(sess.createMessage());
      sess.commit();
      MessageConsumer cons = sess.createConsumer(queue);
      cons.receive();
      sess.commit();
     
      ClientSessionDelegate del = (ClientSessionDelegate)((JBossSession)sess).getDelegate();
View Full Code Here

      MessageProducer prod = sess.createProducer(queue);
      prod.send(sess.createMessage());
      sess.commit();
      MessageConsumer cons = sess.createConsumer(queue);
      cons.receive();
      sess.commit();
     
      ClientSessionDelegate del = (ClientSessionDelegate)((JBossSession)sess).getDelegate();
     
      SessionState state = (SessionState)del.getState();
      ConnectionState cState = (ConnectionState)state.getParent();
View Full Code Here

      TextMessage m = session.createTextMessage("message one");
      prod.send(m);
      m = session.createTextMessage("message two");
      prod.send(m);

      session.commit();

      conn.close();

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

      TextMessage m = session.createTextMessage("message one");
      prod.send(m);
      m = session.createTextMessage("message two");
      prod.send(m);

      session.commit();

      conn.close();

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

         prod.setDeliveryMode(DeliveryMode.PERSISTENT);
         prod.send(session.createTextMessage("clik-persistent"));
         prod.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
         prod.send(session.createTextMessage("clak-non-persistent"));

         session.commit();

         // close the producer
         prod.close();

         // create a consumer and receive messages, but don't acknowledge
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.