XAResource res = sess.getXAResource();
MessageProducer prod = sess.createProducer(queue);
xid1 = new MessagingXid("blah1".getBytes(), 42, "blahblah1".getBytes());
TextMessage tm = sess.createTextMessage("message1");
res.start(xid1, XAResource.TMNOFLAGS);
prod.send(tm);
res.end(xid1, XAResource.TMSUCCESS);
res.prepare(xid1);
}
{
XASession sess = conn.createXASession();
XAResource res = sess.getXAResource();
MessageProducer prod = sess.createProducer(queue);
xid2 = new MessagingXid("blah2".getBytes(), 42, "blahblah2".getBytes());
TextMessage tm = sess.createTextMessage("message1");
res.start(xid2, XAResource.TMNOFLAGS);