@Test
public void sessionTransactedTest() throws JMSException,
InterruptedException {
System.out.println(" sessionTransactedTest");
c = cf.createConnection();
c.start();
Session transactedSession = c.createSession(true, 0);
Destination queue = transactedSession.createQueue("TransQueue");
MessageProducer pr = transactedSession.createProducer(queue);
for (int i = 0; i < 10; i++) {
Message m = transactedSession.createTextMessage("TestMessage" + i);
pr.send(m);
}
MessageConsumer cons = transactedSession.createConsumer(queue);
TextMessage m = (TextMessage) cons.receive(5000);
System.out.println(" consumer message recieved");
Assert.assertNull(m);
transactedSession.commit();
System.out.println(" transaction commited");
transactedSession.close();
System.out.println(" transaction closed");
}