Package javax.jms

Examples of javax.jms.MessageConsumer.receive()


      tm.setText("Your mum");

      prod.send(tm);

      TextMessage tm2 = (TextMessage)cons1.receive();

      assertNotNull(tm2);

      assertEquals("Your mum", tm2.getText());
View Full Code Here


      //this should cancel message and cause delivery to other consumer

      sessConsume1.close();

      TextMessage tm3 = (TextMessage)cons2.receive(1000);

      assertNotNull(tm3);

      assertEquals("Your mum", tm3.getText());
View Full Code Here

         Session sessReceive = connReceive.createSession(true, Session.SESSION_TRANSACTED);

         MessageConsumer cons = sessReceive.createConsumer(queue2);

         TextMessage m2 = (TextMessage)cons.receive(1500);

         assertNotNull(m2);

         assertEquals("hello", m2.getText());
View Full Code Here

      consumerSession.commit();

      // I expect that "Two" is still in the queue

      MessageConsumer queueConsumer2 = consumerSession.createConsumer(queue);
      m =  (TextMessage)queueConsumer2.receive(1500);
      assertNotNull(m);
      assertEquals(m.getText(), "Two");

      consumerSession.commit();
View Full Code Here

          prod.send(tm3);
          sess.commit();

          MessageConsumer cons1 = sess.createConsumer(queue);

          TextMessage rm1 = (TextMessage)cons1.receive();
          assertNotNull(rm1);
          assertEquals("a", rm1.getText());

          cons1.close();
View Full Code Here

          MessageConsumer cons2 = sess.createConsumer(queue);

          sess.commit();

          TextMessage rm2 = (TextMessage)cons2.receive(1500);
          assertNotNull(rm2);
          assertEquals("b", rm2.getText());

          TextMessage rm3 = (TextMessage)cons2.receive(1500);
          assertNotNull(rm3);
View Full Code Here

          TextMessage rm2 = (TextMessage)cons2.receive(1500);
          assertNotNull(rm2);
          assertEquals("b", rm2.getText());

          TextMessage rm3 = (TextMessage)cons2.receive(1500);
          assertNotNull(rm3);
          assertEquals("c", rm3.getText());

          TextMessage rm4 = (TextMessage)cons2.receive(1500);
          assertNull(rm4);
View Full Code Here

          TextMessage rm3 = (TextMessage)cons2.receive(1500);
          assertNotNull(rm3);
          assertEquals("c", rm3.getText());

          TextMessage rm4 = (TextMessage)cons2.receive(1500);
          assertNull(rm4);


       }
       finally
View Full Code Here

          prod.send(tm3);
          sess.commit();

          MessageConsumer cons1 = sess.createConsumer(queue);

          TextMessage rm1 = (TextMessage)cons1.receive(1500);
          assertNotNull(rm1);
          assertEquals("hello1", rm1.getText());

          cons1.close();
View Full Code Here

          MessageConsumer cons2 = sess.createConsumer(queue);

          sess.commit();

          TextMessage rm2 = (TextMessage)cons2.receive(1500);
          assertNotNull(rm2);
          assertEquals("hello2", rm2.getText());

          TextMessage rm3 = (TextMessage)cons2.receive(1500);
          assertNotNull(rm3);
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.