sf.setBlockOnNonDurableSend(true);
sf.setBlockOnDurableSend(true);
ClientSession session = sf.createSession(true, false, false);
Xid xid = new XidImpl("uhuhuhu".getBytes(), 126512, "auhsduashd".getBytes());
session.createQueue(FailoverTestBase.ADDRESS, FailoverTestBase.ADDRESS, null, true);
final CountDownLatch latch = new CountDownLatch(1);
class MyListener extends BaseListener
{
public void connectionFailed(final HornetQException me)
{
latch.countDown();
}
}
session.addFailureListener(new MyListener());
ClientProducer producer = session.createProducer(FailoverTestBase.ADDRESS);
final int numMessages = 100;
session.start(xid, XAResource.TMNOFLAGS);
for (int i = 0; i < numMessages; i++)
{
ClientMessage message = session.createMessage(i % 2 == 0);
setBody(i, message);
message.putIntProperty("counter", i);
producer.send(message);
}
session.end(xid, XAResource.TMSUCCESS);
session.prepare(xid);
session.commit(xid, false);
fail(session, latch);
ClientConsumer consumer = session.createConsumer(FailoverTestBase.ADDRESS);
session.start();
Xid xid2 = new XidImpl("tfytftyf".getBytes(), 54654, "iohiuohiuhgiu".getBytes());
session.start(xid2, XAResource.TMNOFLAGS);
for (int i = 0; i < numMessages; i++)
{