Search in sources :

Example 11 with PagingStoreImpl

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();
}
Also used : RoutingContext(org.apache.activemq.artemis.core.server.RoutingContext) PagingStoreImpl(org.apache.activemq.artemis.core.paging.impl.PagingStoreImpl) CoreMessage(org.apache.activemq.artemis.core.message.impl.CoreMessage) Message(org.apache.activemq.artemis.api.core.Message) CoreMessage(org.apache.activemq.artemis.core.message.impl.CoreMessage) ActiveMQBuffer(org.apache.activemq.artemis.api.core.ActiveMQBuffer)

Aggregations

PagingStoreImpl (org.apache.activemq.artemis.core.paging.impl.PagingStoreImpl)11 Test (org.junit.Test)9 Message (org.apache.activemq.artemis.api.core.Message)8 CoreMessage (org.apache.activemq.artemis.core.message.impl.CoreMessage)8 AddressSettings (org.apache.activemq.artemis.core.settings.impl.AddressSettings)7 ActiveMQBuffer (org.apache.activemq.artemis.api.core.ActiveMQBuffer)6 SimpleString (org.apache.activemq.artemis.api.core.SimpleString)6 SequentialFileFactory (org.apache.activemq.artemis.core.io.SequentialFileFactory)6 NIOSequentialFileFactory (org.apache.activemq.artemis.core.io.nio.NIOSequentialFileFactory)6 PagingStoreFactory (org.apache.activemq.artemis.core.paging.PagingStoreFactory)6 RoutingContextImpl (org.apache.activemq.artemis.core.server.impl.RoutingContextImpl)6 FakeSequentialFileFactory (org.apache.activemq.artemis.tests.unit.core.journal.impl.fakes.FakeSequentialFileFactory)6 ArrayList (java.util.ArrayList)5 PagedMessage (org.apache.activemq.artemis.core.paging.PagedMessage)5 PagingStore (org.apache.activemq.artemis.core.paging.PagingStore)5 Page (org.apache.activemq.artemis.core.paging.impl.Page)4 NullStorageManager (org.apache.activemq.artemis.core.persistence.impl.nullpm.NullStorageManager)4 SequentialFile (org.apache.activemq.artemis.core.io.SequentialFile)3 PageCursorProvider (org.apache.activemq.artemis.core.paging.cursor.PageCursorProvider)3 PageSubscription (org.apache.activemq.artemis.core.paging.cursor.PageSubscription)3