MessageConsumer cons = sess.createConsumer(queue);
conn.start();
TextMessage tm = (TextMessage)cons.receive();
assertEquals("a message", tm.getText());
assertFalse(tm.getJMSRedelivered());
assertEquals(1, tm.getIntProperty("JMSXDeliveryCount"));
sess.rollback();
sess.close();
Session sess2 = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
cons = sess2.createConsumer(queue);
tm = (TextMessage)cons.receive();
assertEquals("a message", tm.getText());
assertEquals(2, tm.getIntProperty("JMSXDeliveryCount"));
assertTrue(tm.getJMSRedelivered());
}
finally
{
if (conn != null)
{