Package javax.jms

Examples of javax.jms.QueueSession.commit()


            for(int i = 0; i < num; i++) {
                Integer I = (Integer)((ObjectMessage)ml.getReceivedMessage(i)).getObject();
                Assert.assertEquals("message sequence", i, I.intValue());
            }
            /* Commit the receiving session, so all messages are finally cleared */
            s_rec.commit();
        } 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


                Integer I = (Integer)((ObjectMessage)ml.getReceivedMessage(i)).getObject();
                result += I.intValue();
            }
            Assert.assertEquals("sum of message-values", (sum * num), result);
            /* Commit the receiving session, so all messages are finally cleared */
            s_rec.commit();
        } finally {
            try { s_rec.close()} catch(Exception ex) {}
            try { qc.close();     } catch(Exception ex) {}
        }
    }
View Full Code Here

                Assert.assertNotNull(i + ":integer-redeliver", I);
                Assert.assertEquals("Integer-Value-redeliver", i, I.intValue());
                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) {}
View Full Code Here

                Assert.assertEquals("Integer-Value-redeliver", i, I.intValue());
                Assert.assertTrue(i + ":redelivered", omsg.getJMSRedelivered());
            }
            /* commit the session and clear messages */
            s_rec.commit();
        } 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

            /* 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());
            /* create another message for sending */
            msg = s_send.createObjectMessage(new Integer(0));
View Full Code Here

            /* 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) {}
            try { s_send.close(); } catch(Exception ex) {}
            try { qc.close();     } catch(Exception ex) {}
View Full Code Here

                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();
        } 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

            qsender.send(msg);
            s_send.commit();
            //consume message 1
            msg = qr_bbb.receiveNoWait();
            Assert.assertNull(msg);
            s_rec.commit();
            msg = qr_aaa.receiveNoWait();
            Assert.assertNotNull(msg);
            Assert.assertEquals("myprop", "aaa", msg.getStringProperty("myprop"));
            s_rec.commit();
           
View Full Code Here

            Assert.assertNull(msg);
            s_rec.commit();
            msg = qr_aaa.receiveNoWait();
            Assert.assertNotNull(msg);
            Assert.assertEquals("myprop", "aaa", msg.getStringProperty("myprop"));
            s_rec.commit();
           
            //send message 2
            msg = s_send.createObjectMessage(new Integer(i++));
            msg.setStringProperty("myprop", "bbb");
            qsender.send(msg);
View Full Code Here

            qsender.send(msg);
            s_send.commit();
            //consume message 2
            msg = qr_aaa.receiveNoWait();
            Assert.assertNull(msg);
            s_rec.commit();
            msg = qr_bbb.receiveNoWait();
            Assert.assertNotNull(msg);
            Assert.assertEquals("myprop", "bbb", msg.getStringProperty("myprop"));
            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.