Message message = session.createTextMessage();
// Publish a message using "AutoAcknowledge"
publisher.publish(message);
resource.end(xid1, XAResource.TMSUCCESS);
resource.prepare(xid1);
// JBossMessaging only sends the message when a commit is done, while JBossMQ would send messages to consumers on the same session,
// doing something differently on the transaction isolation.
// Because of that this commit is necessary to complete this testcase.
resource.commit(xid1, false);