Search in sources :

Example 6 with VMPendingQueueMessageStoragePolicy

use of org.apache.activemq.broker.region.policy.VMPendingQueueMessageStoragePolicy in project activemq-artemis by apache.

the class ExpiredMessagesTest method createBroker.

private BrokerService createBroker(boolean deleteAllMessages, long expireMessagesPeriod) throws Exception {
    BrokerService broker = new BrokerService();
    broker.setBrokerName("localhost");
    broker.setDestinations(new ActiveMQDestination[] { destination });
    broker.setPersistenceAdapter(new MemoryPersistenceAdapter());
    PolicyEntry defaultPolicy = new PolicyEntry();
    if (useVMCursor) {
        defaultPolicy.setPendingQueuePolicy(new VMPendingQueueMessageStoragePolicy());
    }
    defaultPolicy.setExpireMessagesPeriod(expireMessagesPeriod);
    defaultPolicy.setMaxExpirePageSize(1200);
    PolicyMap policyMap = new PolicyMap();
    policyMap.setDefaultEntry(defaultPolicy);
    broker.setDestinationPolicy(policyMap);
    broker.setDeleteAllMessagesOnStartup(deleteAllMessages);
    broker.addConnector("tcp://localhost:0");
    broker.start();
    broker.waitUntilStarted();
    return broker;
}
Also used : MemoryPersistenceAdapter(org.apache.activemq.store.memory.MemoryPersistenceAdapter) PolicyMap(org.apache.activemq.broker.region.policy.PolicyMap) VMPendingQueueMessageStoragePolicy(org.apache.activemq.broker.region.policy.VMPendingQueueMessageStoragePolicy) BrokerService(org.apache.activemq.broker.BrokerService) PolicyEntry(org.apache.activemq.broker.region.policy.PolicyEntry)

Aggregations

VMPendingQueueMessageStoragePolicy (org.apache.activemq.broker.region.policy.VMPendingQueueMessageStoragePolicy)6 PolicyEntry (org.apache.activemq.broker.region.policy.PolicyEntry)4 PolicyMap (org.apache.activemq.broker.region.policy.PolicyMap)3 ArrayList (java.util.ArrayList)2 BrokerService (org.apache.activemq.broker.BrokerService)2 FilePendingQueueMessageStoragePolicy (org.apache.activemq.broker.region.policy.FilePendingQueueMessageStoragePolicy)2 SystemUsage (org.apache.activemq.usage.SystemUsage)2 File (java.io.File)1 URI (java.net.URI)1 TransportConnector (org.apache.activemq.broker.TransportConnector)1 NoSubscriptionRecoveryPolicy (org.apache.activemq.broker.region.policy.NoSubscriptionRecoveryPolicy)1 PendingQueueMessageStoragePolicy (org.apache.activemq.broker.region.policy.PendingQueueMessageStoragePolicy)1 VMPendingSubscriberMessageStoragePolicy (org.apache.activemq.broker.region.policy.VMPendingSubscriberMessageStoragePolicy)1 ActiveMQDestination (org.apache.activemq.command.ActiveMQDestination)1 OpenWireFormat (org.apache.activemq.openwire.OpenWireFormat)1 PersistenceAdapter (org.apache.activemq.store.PersistenceAdapter)1 JDBCPersistenceAdapter (org.apache.activemq.store.jdbc.JDBCPersistenceAdapter)1 KahaDBPersistenceAdapter (org.apache.activemq.store.kahadb.KahaDBPersistenceAdapter)1 MemoryPersistenceAdapter (org.apache.activemq.store.memory.MemoryPersistenceAdapter)1