347348349350351352353354355356357
sess.commit(); mSent.setText("rollback"); producer.send(mSent); sess.commit(); mRec = (TextMessage)consumer.receive(2000); sess.rollback(); TextMessage mRec2 = (TextMessage)consumer.receive(2000);
354355356357358359360361362363364
mRec = (TextMessage)consumer.receive(2000); sess.rollback(); TextMessage mRec2 = (TextMessage)consumer.receive(2000); sess.commit(); assertNotNull(mRec2); assertEquals(mRec.getText(), mRec2.getText()); }
516517518519520521522523524525526
log.trace("Received " + count + " messages"); assertEquals(NUM_MESSAGES, count); consumerSess.commit(); log.trace("Committed session"); conn.stop(); consumer.close();
618619620621622623624625626627628
Message mSent = sess.createTextMessage("igloo"); producer.send(mSent); sess.commit(); TextMessage mRec = (TextMessage)consumer.receive(2000); assertEquals("igloo", mRec.getText()); assertFalse(mRec.getJMSRedelivered());
629630631632633634635636637638639
sess.rollback(); mRec = (TextMessage)consumer.receive(2000); assertEquals("igloo", mRec.getText()); assertTrue(mRec.getJMSRedelivered()); sess.commit(); } finally { if (conn != null) {
716717718719720721722723724725726
TextMessage mSent = sess.createTextMessage("igloo"); producer.send(mSent); log.trace("sent1"); sess.commit(); TextMessage mRec = (TextMessage)consumer.receive(); log.trace("Got 1"); assertNotNull(mRec); assertEquals("igloo", mRec.getText());
723724725726727728729730731732733
TextMessage mRec = (TextMessage)consumer.receive(); log.trace("Got 1"); assertNotNull(mRec); assertEquals("igloo", mRec.getText()); sess.commit(); mSent.setText("rollback"); producer.send(mSent); sess.commit();
577578579580581582583584585586587
Message m = sessSend.createTextMessage("hello"); prod.send(m); sessSend.commit(); connReceive = cf.createConnection(); connReceive.start();
597598599600601602603604605606607
//It is legal to close the consumer before committing the tx which is when //the acks are sent cons.close(); sessReceive.commit(); connReceive.close(); log.trace("Done test");
728729730731732733734735736737738
TextMessage tm2 = sess.createTextMessage("b"); TextMessage tm3 = sess.createTextMessage("c"); prod.send(tm1); prod.send(tm2); prod.send(tm3); sess.commit(); MessageConsumer cons1 = sess.createConsumer(queue); TextMessage rm1 = (TextMessage)cons1.receive(); assertNotNull(rm1);