Java Code Examples for org.apache.activemq.broker.region.policy.PolicyEntry#setDispatchPolicy()
The following examples show how to use
org.apache.activemq.broker.region.policy.PolicyEntry#setDispatchPolicy() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RoundRobinDispatchPolicyTest.java From activemq-artemis with Apache License 2.0 | 5 votes |
@Override protected BrokerService createBroker() throws Exception { BrokerService broker = super.createBroker(); PolicyEntry policy = new PolicyEntry(); policy.setDispatchPolicy(new RoundRobinDispatchPolicy()); PolicyMap pMap = new PolicyMap(); pMap.setDefaultEntry(policy); broker.setDestinationPolicy(pMap); return broker; }
Example 2
Source File: SimpleDispatchPolicyTest.java From activemq-artemis with Apache License 2.0 | 5 votes |
@Override protected BrokerService createBroker() throws Exception { BrokerService broker = super.createBroker(); PolicyEntry policy = new PolicyEntry(); policy.setDispatchPolicy(new SimpleDispatchPolicy()); policy.setSubscriptionRecoveryPolicy(new FixedCountSubscriptionRecoveryPolicy()); PolicyMap pMap = new PolicyMap(); pMap.setDefaultEntry(policy); broker.setDestinationPolicy(pMap); return broker; }
Example 3
Source File: StrictOrderDispatchPolicyTest.java From activemq-artemis with Apache License 2.0 | 5 votes |
@Override protected BrokerService createBroker() throws Exception { BrokerService broker = super.createBroker(); PolicyEntry policy = new PolicyEntry(); policy.setDispatchPolicy(new StrictOrderDispatchPolicy()); PolicyMap pMap = new PolicyMap(); pMap.setDefaultEntry(policy); broker.setDestinationPolicy(pMap); return broker; }
Example 4
Source File: RequestReplyTempDestRemovalAdvisoryRaceTest.java From activemq-artemis with Apache License 2.0 | 5 votes |
@Override protected void setUp() throws Exception { super.setUp(); responseReceived.set(0); respondentSendError.set(0); forwardFailures.set(0); sendsWithNoConsumers.set(0); networkConnectors.clear(); advisoryConsumerConnections.clear(); consumerDemandExists = new CountDownLatch(1); createBroker(new URI("broker:(tcp://localhost:0)/" + BROKER_A + "?persistent=false&useJmx=false")).setDedicatedTaskRunner(false); createBroker(new URI("broker:(tcp://localhost:0)/" + BROKER_B + "?persistent=false&useJmx=false")).setDedicatedTaskRunner(false); createBroker(new URI("broker:(tcp://localhost:0)/" + BROKER_C + "?persistent=false&useJmx=false")).setDedicatedTaskRunner(false); PolicyMap map = new PolicyMap(); PolicyEntry defaultEntry = new PolicyEntry(); defaultEntry.setSendAdvisoryIfNoConsumers(true); DeadLetterStrategy deadletterStrategy = new SharedDeadLetterStrategy(); deadletterStrategy.setProcessNonPersistent(true); defaultEntry.setDeadLetterStrategy(deadletterStrategy); defaultEntry.setDispatchPolicy(new PriorityDispatchPolicy()); map.put(new ActiveMQTempTopic(">"), defaultEntry); for (BrokerItem item : brokers.values()) { item.broker.setDestinationPolicy(map); } }
Example 5
Source File: NoDuplicateOnTopicNetworkTest.java From activemq-artemis with Apache License 2.0 | 5 votes |
private BrokerService createAndStartBroker(String name, String addr) throws Exception { BrokerService broker = new BrokerService(); broker.setDeleteAllMessagesOnStartup(true); broker.setBrokerName(name); broker.addConnector(addr).setDiscoveryUri(new URI(MULTICAST_DEFAULT)); broker.setUseJmx(false); NetworkConnector networkConnector = broker.addNetworkConnector(MULTICAST_DEFAULT); networkConnector.setDecreaseNetworkConsumerPriority(true); networkConnector.setDynamicOnly(dynamicOnly); networkConnector.setNetworkTTL(ttl); networkConnector.setSuppressDuplicateTopicSubscriptions(suppressDuplicateTopicSubs); networkConnector.setConsumerPriorityBase(BASE_PRIORITY); networkConnector.addStaticallyIncludedDestination(new ActiveMQTopic("BeStaticallyIncluded")); PolicyMap policyMap = new PolicyMap(); PolicyEntry policy = new PolicyEntry(); policy.setDispatchPolicy(dispatchPolicy); // the audit will suppress the duplicates as it defaults to true so this test // checking for dups will fail. it is good to have it on in practice. policy.setEnableAudit(false); policyMap.put(new ActiveMQTopic(TOPIC_NAME), policy); broker.setDestinationPolicy(policyMap); broker.start(); return broker; }
Example 6
Source File: BrokerTestSupport.java From activemq-artemis with Apache License 2.0 | 4 votes |
protected PolicyEntry getDefaultPolicy() { PolicyEntry policy = new PolicyEntry(); policy.setDispatchPolicy(new RoundRobinDispatchPolicy()); policy.setSubscriptionRecoveryPolicy(new FixedCountSubscriptionRecoveryPolicy()); return policy; }