Package javax.jms

Examples of javax.jms.TopicSubscriber.receiveNoWait()


         resource.rollback(xid1);

         xid1 = new MyXid();
         resource.start(xid1, XAResource.TMNOFLAGS);
         // Receive the message using "AutoAcknowledge"
         message = subscriber.receiveNoWait();
         if (message == null)
            fail("No message after rollback?");
         resource.end(xid1, XAResource.TMSUCCESS);
         resource.commit(xid1, true);
View Full Code Here


      //send it back
      sender2.publish(msg);

      msg = (TextMessage) subscriber1.receive(2000);
      assertTrue("Subscriber1 should get a message, got " + msg, msg != null && msg.getText().equals("Message"));
      assertTrue("Subscriber2 should not get a message", subscriber2.receiveNoWait() == null);

      topicConnection1.stop();
      topicConnection1.close();
      topicConnection2.stop();
      topicConnection2.close();
View Full Code Here

            tpub.publish(msg);
            s_send.commit();

            Message msg1 = ts1.receiveNoWait();
            Message msg2 = ts2.receiveNoWait();
            Message msg3 = ts3.receiveNoWait();

            s_rec1.commit();
            s_rec2.commit();

            //message-properties do not match the selector
View Full Code Here

            tpub.publish(msg);
            s_send.commit();

            msg1 = ts1.receiveNoWait();
            msg2 = ts2.receiveNoWait();
            msg3 = ts3.receiveNoWait();

            s_rec1.commit();
            s_rec2.commit();

            Assert.assertNotNull(msg1);
View Full Code Here

            /* Commit the sending session */
            s_send.commit();
            /* Receive the message */
            Message msg1 = ts1.receiveNoWait();
            Message msg2 = ts2.receiveNoWait();
            Message msg3 = ts3.receiveNoWait();
            Assert.assertNotNull("subscriber 1 - message recieved", msg1);
            Assert.assertNotNull("subscriber 2 - message recieved", msg2);
            Assert.assertNotNull("subscriber 3 - message recieved", msg3);
            /* Commit the session 1 to clear the topic */
            s_rec1.commit();
View Full Code Here

            Assert.assertNotNull("subscriber 3 - message recieved", msg3);
            /* Commit the session 1 to clear the topic */
            s_rec1.commit();
            /* Rollback the session 2 */
            s_rec2.rollback();
            msg3 = ts3.receiveNoWait();
            Assert.assertNotNull("subscriber 3 - message redelivered after rollback", msg3);
            /* Commit the session 2 to clear the topic */
            s_rec2.commit();
            /* Check, if the headers are set for msg1 */
            this.checkHeaders(msg1, t, start, type, false, msg.getJMSMessageID());
View Full Code Here

            tp.publish(om);
            om = ts.createObjectMessage(new Integer(num++));
            tp.publish(om);

            TopicSubscriber tsub = ts.createDurableSubscriber(topic, name);
            Message msg = tsub.receiveNoWait();

            Assert.assertNull("initial message", msg);

            om = ts.createObjectMessage(new Integer(num++));
            tp.publish(om);
View Full Code Here

            om = ts.createObjectMessage(new Integer(num++));
            tp.publish(om);
            om = ts.createObjectMessage(new Integer(num++));
            tp.publish(om);

            msg = tsub.receiveNoWait();
            Assert.assertNotNull("fist message", msg);
            Assert.assertEquals("fist message", new Integer(1002),
                                            ((ObjectMessage)msg).getObject());
            msg = tsub.receiveNoWait();
            Assert.assertNotNull("second message", msg);
View Full Code Here

            msg = tsub.receiveNoWait();
            Assert.assertNotNull("fist message", msg);
            Assert.assertEquals("fist message", new Integer(1002),
                                            ((ObjectMessage)msg).getObject());
            msg = tsub.receiveNoWait();
            Assert.assertNotNull("second message", msg);
            Assert.assertEquals("second message", new Integer(1003),
                                            ((ObjectMessage)msg).getObject());

            tsub.close();
View Full Code Here

            om = ts.createObjectMessage(new Integer(num++));
            tp.publish(om);

            tsub = ts.createDurableSubscriber(topic, name);

            msg = tsub.receiveNoWait();
            Assert.assertNotNull("third message", msg);
            Assert.assertEquals("third message", new Integer(1004),
                                            ((ObjectMessage)msg).getObject());
            msg = tsub.receiveNoWait();
            Assert.assertNotNull("fourth message", msg);
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.