Package javax.jms

Examples of javax.jms.MessageConsumer.receive()


         TextMessage t = (TextMessage)cons.receive(1000);
         assertNotNull(t);
         assertEquals("a", t.getText());
      }
      {
         TextMessage t = (TextMessage)cons.receive(1000);
         assertNotNull(t);
         assertEquals("b", t.getText());
      }
      {
         TextMessage t = (TextMessage)cons.receive(1000);
View Full Code Here


         TextMessage t = (TextMessage)cons.receive(1000);
         assertNotNull(t);
         assertEquals("b", t.getText());
      }
      {
         TextMessage t = (TextMessage)cons.receive(1000);
         assertNotNull(t);
         assertEquals("c", t.getText());
      }
      {
         TextMessage t = (TextMessage)cons.receiveNoWait();
View Full Code Here

      s = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
      conn.start();

      ds = s.createDurableSubscriber(thisTopic, "sub", null, false);

      TextMessage rm = (TextMessage)ds.receive(3000);
      assertNotNull(rm);
      assertEquals("thebody", rm.getText());


      conn.close();
View Full Code Here

         {
            break;
         }
         assertEquals("message" + i, tm2.getText());
        
         TextMessage tm3 = (TextMessage)sub3.receive(3000);
         assertNotNull(tm3);
         if (tm3 == null)
         {
            break;
         }
View Full Code Here

         Connection conn = cf.createConnection();
         conn.start();
         Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
         MessageConsumer cons = sess.createConsumer(queue);
         TextMessage tm = (TextMessage)cons.receive(5000);

         assertNotNull(tm);
         assertEquals(MESSAGE_TEXT, tm.getText());

         // the client VM should exit by itself. If it doesn't, that means we have a problem
View Full Code Here

   
    connection.start();
   
    for (int i = 0; i < numMessages; i++)
    {
      Message m = mc.receive();
         assertNotNull(m);
    }
     
      // Need to pause here since delivery is done on a different thread. Message might not be
      // removed from in memory state by this point.
View Full Code Here

      s.close();

      s = conn.createSession(true, Session.SESSION_TRANSACTED);
      MessageConsumer c = s.createConsumer(queue);
      conn.start();
      Message m = c.receive();

      assertEquals("one", ((TextMessage)m).getText());
      assertFalse(m.getJMSRedelivered());
      assertEquals(1, m.getIntProperty("JMSXDeliveryCount"));
View Full Code Here

      assertEquals(1, m.getIntProperty("JMSXDeliveryCount"));

      s.rollback();

      // get the message again
      m = c.receive();
      assertTrue(m.getJMSRedelivered());
      assertEquals(2, m.getIntProperty("JMSXDeliveryCount"));

      conn.close();
     
View Full Code Here

         producer.send(mSent);     
         sessSend.commit();
              
         conn.start();
             
         TextMessage mRec1 = (TextMessage)consumer1.receive(2000);
         assertEquals("igloo", mRec1.getText());
         assertFalse(mRec1.getJMSRedelivered());
        
         sess1.rollback(); //causes redelivery for session
View Full Code Here

         assertEquals("igloo", mRec1.getText());
         assertFalse(mRec1.getJMSRedelivered());
        
         sess1.rollback(); //causes redelivery for session

         mRec1 = (TextMessage)consumer1.receive(2000);
         assertEquals("igloo", mRec1.getText());
         assertTrue(mRec1.getJMSRedelivered());
                          
         sess1.commit();
      }
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.