conn.start();
tm.begin();
// Create 2 sessions and enlist them
XASession sess1 = conn.createXASession();
MessagingXAResource res1 = (MessagingXAResource)sess1.getXAResource();
XASession sess2 = conn.createXASession();
MessagingXAResource res2 = (MessagingXAResource)sess2.getXAResource();
Transaction tx = tm.getTransaction();
tx.enlistResource(res1);
tx.enlistResource(res2);
// Receive the messages, two on each consumer
MessageConsumer cons1 = sess1.createConsumer(queue1);
TextMessage r1 = (TextMessage)cons1.receive(MAX_TIMEOUT);
assertNotNull(r1);
assertEquals("jellyfish1", r1.getText());
r1 = (TextMessage)cons1.receive(MAX_TIMEOUT);
assertNotNull(r1);
assertEquals("jellyfish2", r1.getText());
cons1.close();
MessageConsumer cons2 = sess2.createConsumer(queue1);
TextMessage r2 = (TextMessage)cons2.receive(MAX_TIMEOUT);
assertNotNull(r2);
assertEquals("jellyfish3", r2.getText());