Search in sources :

Example 1 with FilePendingQueueMessageStoragePolicy

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

the class RecoverExpiredMessagesTest method initCombosForTestRecovery.

public void initCombosForTestRecovery() throws Exception {
    addCombinationValues("queuePendingPolicy", new PendingQueueMessageStoragePolicy[] { new FilePendingQueueMessageStoragePolicy(), new VMPendingQueueMessageStoragePolicy() });
    PersistenceAdapter[] persistenceAdapters = new PersistenceAdapter[] { new KahaDBPersistenceAdapter(), new JDBCPersistenceAdapter(DataSourceServiceSupport.createDataSource(IOHelper.getDefaultDataDirectory()), new OpenWireFormat()) };
    for (PersistenceAdapter adapter : persistenceAdapters) {
        adapter.setDirectory(new File(IOHelper.getDefaultDataDirectory()));
    }
    addCombinationValues("persistenceAdapter", persistenceAdapters);
}
Also used : OpenWireFormat(org.apache.activemq.openwire.OpenWireFormat) JDBCPersistenceAdapter(org.apache.activemq.store.jdbc.JDBCPersistenceAdapter) VMPendingQueueMessageStoragePolicy(org.apache.activemq.broker.region.policy.VMPendingQueueMessageStoragePolicy) FilePendingQueueMessageStoragePolicy(org.apache.activemq.broker.region.policy.FilePendingQueueMessageStoragePolicy) File(java.io.File) JDBCPersistenceAdapter(org.apache.activemq.store.jdbc.JDBCPersistenceAdapter) KahaDBPersistenceAdapter(org.apache.activemq.store.kahadb.KahaDBPersistenceAdapter) PersistenceAdapter(org.apache.activemq.store.PersistenceAdapter) KahaDBPersistenceAdapter(org.apache.activemq.store.kahadb.KahaDBPersistenceAdapter)

Example 2 with FilePendingQueueMessageStoragePolicy

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

the class UnlimitedEnqueueTest method createBrokerService.

@Before
public void createBrokerService() throws Exception {
    brokerService = new BrokerService();
    brokerService.setDeleteAllMessagesOnStartup(true);
    brokerService.setAdvisorySupport(false);
    // optional, reduce the usage limit so that spooling will occur faster
    brokerService.getSystemUsage().getMemoryUsage().setLimit(10 * 1024 * 1024);
    brokerService.getSystemUsage().getTempUsage().setLimit((numMessages * payLoadSize) + (1000 * payLoadSize));
    PolicyMap policyMap = new PolicyMap();
    List<PolicyEntry> entries = new ArrayList<>();
    PolicyEntry policy = new PolicyEntry();
    // NB: ensure queue cursor limit is below the default 70% usage that the destination will use
    // if they are the same, the queue memory limit and flow control will kick in first
    policy.setCursorMemoryHighWaterMark(20);
    // on by default
    // policy.setProducerFlowControl(true);
    policy.setQueue(">");
    // policy that will spool references to disk
    policy.setPendingQueuePolicy(new FilePendingQueueMessageStoragePolicy());
    entries.add(policy);
    policyMap.setPolicyEntries(entries);
    brokerService.setDestinationPolicy(policyMap);
    brokerService.start();
}
Also used : PolicyMap(org.apache.activemq.broker.region.policy.PolicyMap) ArrayList(java.util.ArrayList) FilePendingQueueMessageStoragePolicy(org.apache.activemq.broker.region.policy.FilePendingQueueMessageStoragePolicy) BrokerService(org.apache.activemq.broker.BrokerService) PolicyEntry(org.apache.activemq.broker.region.policy.PolicyEntry) Before(org.junit.Before)

Example 3 with FilePendingQueueMessageStoragePolicy

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

the class ExpiredMessagesWithNoConsumerTest method initCombosForTestExpiredMessagesWithNoConsumer.

public void initCombosForTestExpiredMessagesWithNoConsumer() {
    addCombinationValues("optimizedDispatch", new Object[] { Boolean.TRUE, Boolean.FALSE });
    addCombinationValues("pendingQueuePolicy", new Object[] { null, new VMPendingQueueMessageStoragePolicy(), new FilePendingQueueMessageStoragePolicy() });
}
Also used : VMPendingQueueMessageStoragePolicy(org.apache.activemq.broker.region.policy.VMPendingQueueMessageStoragePolicy) FilePendingQueueMessageStoragePolicy(org.apache.activemq.broker.region.policy.FilePendingQueueMessageStoragePolicy)

Example 4 with FilePendingQueueMessageStoragePolicy

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

the class QueuePurgeTest method applyBrokerSpoolingPolicy.

private void applyBrokerSpoolingPolicy() {
    PolicyMap policyMap = new PolicyMap();
    PolicyEntry defaultEntry = new PolicyEntry();
    defaultEntry.setProducerFlowControl(false);
    PendingQueueMessageStoragePolicy pendingQueuePolicy = new FilePendingQueueMessageStoragePolicy();
    defaultEntry.setPendingQueuePolicy(pendingQueuePolicy);
    policyMap.setDefaultEntry(defaultEntry);
    broker.setDestinationPolicy(policyMap);
}
Also used : PolicyMap(org.apache.activemq.broker.region.policy.PolicyMap) FilePendingQueueMessageStoragePolicy(org.apache.activemq.broker.region.policy.FilePendingQueueMessageStoragePolicy) PendingQueueMessageStoragePolicy(org.apache.activemq.broker.region.policy.PendingQueueMessageStoragePolicy) FilePendingQueueMessageStoragePolicy(org.apache.activemq.broker.region.policy.FilePendingQueueMessageStoragePolicy) PolicyEntry(org.apache.activemq.broker.region.policy.PolicyEntry)

Aggregations

FilePendingQueueMessageStoragePolicy (org.apache.activemq.broker.region.policy.FilePendingQueueMessageStoragePolicy)4 PolicyEntry (org.apache.activemq.broker.region.policy.PolicyEntry)2 PolicyMap (org.apache.activemq.broker.region.policy.PolicyMap)2 VMPendingQueueMessageStoragePolicy (org.apache.activemq.broker.region.policy.VMPendingQueueMessageStoragePolicy)2 File (java.io.File)1 ArrayList (java.util.ArrayList)1 BrokerService (org.apache.activemq.broker.BrokerService)1 PendingQueueMessageStoragePolicy (org.apache.activemq.broker.region.policy.PendingQueueMessageStoragePolicy)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 Before (org.junit.Before)1