use of org.apache.activemq.artemis.core.paging.impl.PagingStoreImpl in project activemq-artemis by apache.
the class PageCursorStressTest method addMessages.
private int addMessages(final int start, final int numMessages, final int messageSize) throws Exception {
PagingStoreImpl pageStore = lookupPageStore(ADDRESS);
pageStore.startPaging();
RoutingContext ctx = generateCTX();
for (int i = start; i < start + numMessages; i++) {
if (i % 100 == 0)
System.out.println("Paged " + i);
ActiveMQBuffer buffer = RandomUtil.randomBuffer(messageSize, i + 1L);
Message msg = new CoreMessage(i, buffer.writerIndex());
msg.putIntProperty("key", i);
// to be used on tests that are validating filters
msg.putBooleanProperty("even", i % 2 == 0);
msg.getBodyBuffer().writeBytes(buffer, 0, buffer.writerIndex());
Assert.assertTrue(pageStore.page(msg, ctx.getTransaction(), ctx.getContextListing(ADDRESS), lock));
}
return pageStore.getNumberOfPages();
}
Aggregations