730731732733734735736737738739740
prod.send(tm1); prod.send(tm2); prod.send(tm3); sess.commit(); MessageConsumer cons1 = sess.createConsumer(queue); TextMessage rm1 = (TextMessage)cons1.receive(); assertNotNull(rm1); assertEquals("a", rm1.getText());
738739740741742743744745746747748
assertNotNull(rm1); assertEquals("a", rm1.getText()); cons1.close(); MessageConsumer cons2 = sess.createConsumer(queue); sess.commit(); TextMessage rm2 = (TextMessage)cons2.receive(1500); assertNotNull(rm2);
785786787788789790791792793794795
prod.send(tm1); prod.send(tm2); prod.send(tm3); sess.commit(); MessageConsumer cons1 = sess.createConsumer(queue); TextMessage rm1 = (TextMessage)cons1.receive(1500); assertNotNull(rm1); assertEquals("hello1", rm1.getText());
793794795796797798799800801802803
assertNotNull(rm1); assertEquals("hello1", rm1.getText()); cons1.close(); MessageConsumer cons2 = sess.createConsumer(queue); sess.commit(); TextMessage rm2 = (TextMessage)cons2.receive(1500); assertNotNull(rm2);
839840841842843844845846847848849
849850851852853854855856857858859
cons1.close(); sess.commit(); MessageConsumer cons2 = sess.createConsumer(queue); TextMessage rm2 = (TextMessage)cons2.receive(1500); assertNotNull(rm2); assertEquals("hello2", rm2.getText());
894895896897898899900901902903904
prod.send(tm1); prod.send(tm2); prod.send(tm3); sess.commit(); MessageConsumer cons1 = sess.createConsumer(queue); TextMessage rm1 = (TextMessage)cons1.receive(1500); assertNotNull(rm1); assertEquals("hello1", rm1.getText()); log.trace(rm1.getJMSMessageID());
950951952953954955956957958959960
967968969970971972973974975976977
//in this case redelivery occurs to a different receiver sess.rollback(); MessageConsumer cons2 = sess.createConsumer(queue); TextMessage rm2 = (TextMessage)cons2.receive(1500); assertNotNull(rm2); assertEquals("hello1", rm2.getText());
10151016101710181019102010211022102310241025
TextMessage tm3 = sess.createTextMessage("hello3"); prod.send(tm1); prod.send(tm2); prod.send(tm3); MessageConsumer cons1 = sess.createConsumer(queue); TextMessage rm1 = (TextMessage)cons1.receive(1500); assertNotNull(rm1); assertEquals("hello1", rm1.getText());