session.createQueue(ADDRESS, ADDRESS, true);
session.createQueue("DLA", "DLA");
PagingStore pgStoreAddress = server.getPagingManager().getPageStore(ADDRESS);
pgStoreAddress.startPaging();
PagingStore pgStoreDLA = server.getPagingManager().getPageStore(new SimpleString("DLA"));
ClientProducer producer = session.createProducer(PagingTest.ADDRESS);
for (int i = 0; i < 100; i++)
{
log.debug("send message #" + i);
ClientMessage message = session.createMessage(true);
message.putStringProperty("id", "str" + i);
message.setBodyInputStream(createFakeLargeStream(messageSize));
producer.send(message);
if ((i + 1) % 2 == 0)
{
session.commit();
}
}
session.commit();
session.start();
ClientConsumer cons = session.createConsumer(ADDRESS);
for (int msgNr = 0; msgNr < 2; msgNr++)
{
for (int i = 0; i < 5; i++)
{
ClientMessage msg = cons.receive(5000);
assertNotNull(msg);
msg.acknowledge();
assertEquals("str" + msgNr, msg.getStringProperty("id"));
for (int j = 0; j < messageSize; j++)
{
assertEquals(getSamplebyte(j), msg.getBodyBuffer().readByte());
}
session.rollback();
}
pgStoreDLA.startPaging();
}
for (int i = 2; i < 100; i++)
{
log.debug("Received message " + i);