ClientSessionFactory sf = locator.createSessionFactory();
ClientSession session = sf.createSession(null, null, false, true, true, false, 0);
session.createQueue(PagingTest.ADDRESS, PagingTest.ADDRESS, null, true);
ClientProducer producer = session.createProducer(PagingTest.ADDRESS);
ClientMessage message = null;
byte[] body = new byte[numberOfBytes];
for (int j = 0; j < numberOfBytes; j++)
{
body[j] = UnitTestCase.getSamplebyte(j);
}
long scheduledTime = System.currentTimeMillis() + 5000;
for (int i = 0; i < numberOfMessages; i++)
{
message = session.createMessage(true);
message.getBodyBuffer().writeBytes(body);
message.putIntProperty(new SimpleString("id"), i);
TestSupportPageStore store = (TestSupportPageStore)server.getPostOffice()
.getPagingManager()
.getPageStore(PagingTest.ADDRESS);
// Worse scenario possible... only schedule what's on pages
if (store.getCurrentPage() != null)
{
message.putLongProperty(Message.HDR_SCHEDULED_DELIVERY_TIME, scheduledTime);
}
producer.send(message);
}
if (restart)
{
session.close();