Search in sources :

Example 1 with VMPendingQueueMessageStoragePolicy

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

the class NetworkLoadTest method createBroker.

protected BrokerService createBroker(int brokerId) throws Exception {
    BrokerService broker = new BrokerService();
    broker.setBrokerName("broker-" + brokerId);
    broker.setPersistent(false);
    broker.setUseJmx(true);
    broker.getManagementContext().setCreateConnector(false);
    final SystemUsage memoryManager = new SystemUsage();
    // 50 MB
    memoryManager.getMemoryUsage().setLimit(1024 * 1024 * 50);
    broker.setSystemUsage(memoryManager);
    final List<PolicyEntry> policyEntries = new ArrayList<>();
    final PolicyEntry entry = new PolicyEntry();
    entry.setQueue(">");
    // Set to 1 MB
    entry.setMemoryLimit(1024 * 1024 * 1);
    entry.setPendingSubscriberPolicy(new VMPendingSubscriberMessageStoragePolicy());
    entry.setPendingQueuePolicy(new VMPendingQueueMessageStoragePolicy());
    policyEntries.add(entry);
    // This is to turn of the default behavior of storing topic messages for retroactive consumption
    final PolicyEntry topicPolicyEntry = new PolicyEntry();
    topicPolicyEntry.setTopic(">");
    final NoSubscriptionRecoveryPolicy noSubscriptionRecoveryPolicy = new NoSubscriptionRecoveryPolicy();
    topicPolicyEntry.setSubscriptionRecoveryPolicy(noSubscriptionRecoveryPolicy);
    final PolicyMap policyMap = new PolicyMap();
    policyMap.setPolicyEntries(policyEntries);
    broker.setDestinationPolicy(policyMap);
    TransportConnector transportConnector = new TransportConnector();
    transportConnector.setUri(new URI("tcp://localhost:" + (60000 + brokerId)));
    transportConnector.setDiscoveryUri(new URI("multicast://default?group=" + groupId));
    broker.addConnector(transportConnector);
    DiscoveryNetworkConnector networkConnector = new DiscoveryNetworkConnector();
    networkConnector.setUri(new URI("multicast://default?group=" + groupId));
    networkConnector.setBridgeTempDestinations(true);
    networkConnector.setPrefetchSize(1);
    broker.addNetworkConnector(networkConnector);
    return broker;
}
Also used : TransportConnector(org.apache.activemq.broker.TransportConnector) PolicyMap(org.apache.activemq.broker.region.policy.PolicyMap) VMPendingSubscriberMessageStoragePolicy(org.apache.activemq.broker.region.policy.VMPendingSubscriberMessageStoragePolicy) ArrayList(java.util.ArrayList) SystemUsage(org.apache.activemq.usage.SystemUsage) VMPendingQueueMessageStoragePolicy(org.apache.activemq.broker.region.policy.VMPendingQueueMessageStoragePolicy) BrokerService(org.apache.activemq.broker.BrokerService) PolicyEntry(org.apache.activemq.broker.region.policy.PolicyEntry) URI(java.net.URI) NoSubscriptionRecoveryPolicy(org.apache.activemq.broker.region.policy.NoSubscriptionRecoveryPolicy)

Example 2 with VMPendingQueueMessageStoragePolicy

use of org.apache.activemq.broker.region.policy.VMPendingQueueMessageStoragePolicy 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 3 with VMPendingQueueMessageStoragePolicy

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

the class DestinationCursorConfigTest method testQueueConfiguration.

public void testQueueConfiguration() throws Exception {
    super.topic = false;
    ActiveMQDestination destination = (ActiveMQDestination) createDestination("org.apache.foo");
    PolicyEntry entry = broker.getDestinationPolicy().getEntryFor(destination);
    PendingQueueMessageStoragePolicy policy = entry.getPendingQueuePolicy();
    assertNotNull(policy);
    assertTrue("Policy is: " + policy, policy instanceof VMPendingQueueMessageStoragePolicy);
}
Also used : VMPendingQueueMessageStoragePolicy(org.apache.activemq.broker.region.policy.VMPendingQueueMessageStoragePolicy) VMPendingQueueMessageStoragePolicy(org.apache.activemq.broker.region.policy.VMPendingQueueMessageStoragePolicy) PendingQueueMessageStoragePolicy(org.apache.activemq.broker.region.policy.PendingQueueMessageStoragePolicy) PolicyEntry(org.apache.activemq.broker.region.policy.PolicyEntry) ActiveMQDestination(org.apache.activemq.command.ActiveMQDestination)

Example 4 with VMPendingQueueMessageStoragePolicy

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

the class QueueMemoryFullMultiBrokersTest method applyMemoryLimitPolicy.

private void applyMemoryLimitPolicy(BrokerService broker) {
    final SystemUsage memoryManager = new SystemUsage();
    // 50 MB
    memoryManager.getMemoryUsage().setLimit(1024 * 50);
    broker.setSystemUsage(memoryManager);
    final List<PolicyEntry> policyEntries = new ArrayList<>();
    final PolicyEntry entry = new PolicyEntry();
    entry.setQueue(">");
    // Set to 2 kb
    entry.setMemoryLimit(1024 * 4);
    entry.setPendingQueuePolicy(new VMPendingQueueMessageStoragePolicy());
    policyEntries.add(entry);
    final PolicyMap policyMap = new PolicyMap();
    policyMap.setPolicyEntries(policyEntries);
    broker.setDestinationPolicy(policyMap);
}
Also used : PolicyMap(org.apache.activemq.broker.region.policy.PolicyMap) ArrayList(java.util.ArrayList) SystemUsage(org.apache.activemq.usage.SystemUsage) VMPendingQueueMessageStoragePolicy(org.apache.activemq.broker.region.policy.VMPendingQueueMessageStoragePolicy) PolicyEntry(org.apache.activemq.broker.region.policy.PolicyEntry)

Example 5 with VMPendingQueueMessageStoragePolicy

use of org.apache.activemq.broker.region.policy.VMPendingQueueMessageStoragePolicy 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)

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