session = sf.createSession(null, null, false, true, true, false, 0);
session.start();
ClientConsumer consumerA = session.createConsumer(PAGED_ADDRESS_A);
ClientConsumer consumerB = session.createConsumer(PAGED_ADDRESS_B);
for (int i = 0; i < NUMBER_OF_MESSAGES; i++)
{
ClientMessage msg = consumerA.receive(5000);
Assert.assertNotNull("Couldn't receive a message on consumerA, iteration = " + i, msg);
msg.acknowledge();
}
Assert.assertNull(consumerA.receiveImmediate());
consumerA.close();
Assert.assertTrue(server.getPostOffice().getPagingManager().getPageStore(PAGED_ADDRESS_B).isPaging());
for (int i = 0; i < NUMBER_OF_MESSAGES; i++)
{
ClientMessage msg = consumerB.receive(5000);
Assert.assertNotNull(msg);
msg.acknowledge();
session.commit();
}
Assert.assertNull(consumerB.receiveImmediate());
consumerB.close();
session.close();
}
finally