Package javax.jms

Examples of javax.jms.QueueReceiver.receiveNoWait()


            Assert.assertNotNull("message", msg);
            Assert.assertEquals("object value", new Integer(3), msg.getObject());

            s_rec.recover();

            msg = (ObjectMessage)qr.receiveNoWait();
            Assert.assertNotNull("message", msg);
            Assert.assertEquals("object value", new Integer(3), msg.getObject());

            msg.acknowledge();
View Full Code Here


            Assert.assertNotNull("message", msg);
            Assert.assertEquals("object value", new Integer(3), msg.getObject());

            msg.acknowledge();

            msg = (ObjectMessage)qr.receiveNoWait();
            Assert.assertNotNull("message", msg);
            Assert.assertEquals("object value", new Integer(4), msg.getObject());

            msg.acknowledge();
View Full Code Here

            Assert.assertNotNull("message", msg);
            Assert.assertEquals("object value", new Integer(4), msg.getObject());

            msg.acknowledge();

            msg = (ObjectMessage)qr.receiveNoWait();
            Assert.assertNull("message", msg);

        } finally {
            try { s_rec.close()} catch(Exception ex) {}
            try { s_send.close(); } catch(Exception ex) {}
View Full Code Here

            }
            /* Commit the sending session */
            s_send.commit();
            /* Receive the messages in the queue */
            for(int i = 0; i < num; i++) {
                ObjectMessage omsg = (ObjectMessage)qr.receiveNoWait();
                Assert.assertNotNull(i + ":message", omsg);
                Integer I = (Integer)omsg.getObject();
                Assert.assertNotNull(i + ":integer", I);
                Assert.assertEquals("Integer-Value", i, I.intValue());
                Assert.assertTrue(i + ":redelivered", !omsg.getJMSRedelivered());
View Full Code Here

                Integer I = (Integer)omsg.getObject();
                Assert.assertNotNull(i + ":integer", I);
                Assert.assertEquals("Integer-Value", i, I.intValue());
                Assert.assertTrue(i + ":redelivered", !omsg.getJMSRedelivered());
            }
            Message msg = qr.receiveNoWait();
            Assert.assertNull("null-message", msg);
            /* rollback session and receive message again */
            s_rec.rollback();
            /* AGAIN:Receive the 5 messages in the queue */
            for(int i = 0; i < num; i++) {
View Full Code Here

            Assert.assertNull("null-message", msg);
            /* rollback session and receive message again */
            s_rec.rollback();
            /* AGAIN:Receive the 5 messages in the queue */
            for(int i = 0; i < num; i++) {
                ObjectMessage omsg = (ObjectMessage)qr.receiveNoWait();
                Assert.assertNotNull(i + ":message-redeliver", omsg);
                Integer I = (Integer)omsg.getObject();
                Assert.assertNotNull(i + ":integer-redeliver", I);
                Assert.assertEquals("Integer-Value-redeliver", i, I.intValue());
                Assert.assertTrue(i + ":redelivered", omsg.getJMSRedelivered());
View Full Code Here

                Assert.assertTrue(i + ":redelivered", omsg.getJMSRedelivered());
            }
            /* commit the session and clear messages */
            s_rec.commit();
            /* Check that there is no more message to receive */
            msg = qr.receiveNoWait();
            Assert.assertNull("null-message", msg);
        } finally {
            try { s_rec.close()} catch(Exception ex) {}
            try { s_send.close(); } catch(Exception ex) {}
            try { qc.close();     } catch(Exception ex) {}
View Full Code Here

            /* Commit the sending session */
            s_send.commit();
            /* wait ... */
            Thread.sleep(5000);
            /* Receive the message */
            msg = qr.receiveNoWait();
            /* commit the receiving-session, in case we got something */
            s_rec.commit();
            Assert.assertNotNull("Expected to receive a message", msg);
            Assert.assertTrue("TTL must be greater then current-time",
                        msg.getJMSExpiration() > System.currentTimeMillis());
View Full Code Here

            /* Commit the sending session */
            s_send.commit();
            /* wait, to make sure TTL takes effect */
            Thread.sleep(10000);
            /* Receive the message. Well, we do not expect to get one */
            msg = qr.receiveNoWait();
            /* commit the receiving-session, in case we got something */
            s_rec.commit();
            Assert.assertNull("Did not expect to receive a message", msg);
        } finally {
            try { s_rec.close()} catch(Exception ex) {}
View Full Code Here

            s_send.commit();
            /* wait ... */
            Thread.sleep(1000);
            /* Receive the message */
            for(int i = (num - 1); i >= 0; i--) {
                ObjectMessage msg = (ObjectMessage)qr.receiveNoWait();
                Integer I = (Integer)msg.getObject();
                Assert.assertEquals("Message-Value", i, I.intValue());
            }
            /* commit the receiving-session, in case we got something */
            s_rec.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.