Search in sources :

Example 1 with VMPendingSubscriberMessageStoragePolicy

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

the class MessageExpirationTest method getDefaultPolicy.

@Override
protected PolicyEntry getDefaultPolicy() {
    PolicyEntry policy = super.getDefaultPolicy();
    // disable spooling
    policy.setPendingSubscriberPolicy(new VMPendingSubscriberMessageStoragePolicy());
    // have aggressive expiry period to ensure no deadlock or clash
    policy.setExpireMessagesPeriod(100);
    return policy;
}
Also used : VMPendingSubscriberMessageStoragePolicy(org.apache.activemq.broker.region.policy.VMPendingSubscriberMessageStoragePolicy) PolicyEntry(org.apache.activemq.broker.region.policy.PolicyEntry)

Example 2 with VMPendingSubscriberMessageStoragePolicy

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

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

the class DestinationCursorConfigTest method testTopicConfiguration.

public void testTopicConfiguration() throws Exception {
    super.topic = true;
    ActiveMQDestination destination = (ActiveMQDestination) createDestination("org.apache.foo");
    PolicyEntry entry = broker.getDestinationPolicy().getEntryFor(destination);
    PendingSubscriberMessageStoragePolicy policy = entry.getPendingSubscriberPolicy();
    assertNotNull(policy);
    assertFalse(entry.isProducerFlowControl());
    assertTrue(entry.getMemoryLimit() == (1024 * 1024));
    assertTrue("subscriberPolicy is: " + policy, policy instanceof VMPendingSubscriberMessageStoragePolicy);
}
Also used : VMPendingSubscriberMessageStoragePolicy(org.apache.activemq.broker.region.policy.VMPendingSubscriberMessageStoragePolicy) PendingSubscriberMessageStoragePolicy(org.apache.activemq.broker.region.policy.PendingSubscriberMessageStoragePolicy) VMPendingSubscriberMessageStoragePolicy(org.apache.activemq.broker.region.policy.VMPendingSubscriberMessageStoragePolicy) PolicyEntry(org.apache.activemq.broker.region.policy.PolicyEntry) ActiveMQDestination(org.apache.activemq.command.ActiveMQDestination)

Aggregations

PolicyEntry (org.apache.activemq.broker.region.policy.PolicyEntry)3 VMPendingSubscriberMessageStoragePolicy (org.apache.activemq.broker.region.policy.VMPendingSubscriberMessageStoragePolicy)3 URI (java.net.URI)1 ArrayList (java.util.ArrayList)1 BrokerService (org.apache.activemq.broker.BrokerService)1 TransportConnector (org.apache.activemq.broker.TransportConnector)1 NoSubscriptionRecoveryPolicy (org.apache.activemq.broker.region.policy.NoSubscriptionRecoveryPolicy)1 PendingSubscriberMessageStoragePolicy (org.apache.activemq.broker.region.policy.PendingSubscriberMessageStoragePolicy)1 PolicyMap (org.apache.activemq.broker.region.policy.PolicyMap)1 VMPendingQueueMessageStoragePolicy (org.apache.activemq.broker.region.policy.VMPendingQueueMessageStoragePolicy)1 ActiveMQDestination (org.apache.activemq.command.ActiveMQDestination)1 SystemUsage (org.apache.activemq.usage.SystemUsage)1