Java Code Examples for org.apache.activemq.broker.region.policy.PolicyEntry#setTopicPrefetch()
The following examples show how to use
org.apache.activemq.broker.region.policy.PolicyEntry#setTopicPrefetch() .
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: AbortSlowAckConsumer1Test.java From activemq-artemis with Apache License 2.0 | 6 votes |
@Override protected BrokerService createBroker() throws Exception { BrokerService broker = super.createBroker(); PolicyEntry policy = new PolicyEntry(); AbortSlowAckConsumerStrategy strategy = new AbortSlowAckConsumerStrategy(); strategy.setAbortConnection(abortConnection); strategy.setCheckPeriod(checkPeriod); strategy.setMaxSlowDuration(maxSlowDuration); strategy.setMaxTimeSinceLastAck(maxTimeSinceLastAck); policy.setSlowConsumerStrategy(strategy); policy.setQueuePrefetch(10); policy.setTopicPrefetch(10); PolicyMap pMap = new PolicyMap(); pMap.setDefaultEntry(policy); broker.setDestinationPolicy(pMap); return broker; }
Example 2
Source File: AbortSlowAckConsumer2Test.java From activemq-artemis with Apache License 2.0 | 6 votes |
@Override protected BrokerService createBroker() throws Exception { BrokerService broker = super.createBroker(); PolicyEntry policy = new PolicyEntry(); AbortSlowAckConsumerStrategy strategy = new AbortSlowAckConsumerStrategy(); strategy.setAbortConnection(abortConnection); strategy.setCheckPeriod(checkPeriod); strategy.setMaxSlowDuration(maxSlowDuration); strategy.setMaxTimeSinceLastAck(maxTimeSinceLastAck); policy.setSlowConsumerStrategy(strategy); policy.setQueuePrefetch(10); policy.setTopicPrefetch(10); PolicyMap pMap = new PolicyMap(); pMap.setDefaultEntry(policy); broker.setDestinationPolicy(pMap); return broker; }
Example 3
Source File: AbortSlowAckConsumer0Test.java From activemq-artemis with Apache License 2.0 | 6 votes |
@Override protected BrokerService createBroker() throws Exception { BrokerService broker = super.createBroker(); PolicyEntry policy = new PolicyEntry(); strategy = createSlowConsumerStrategy(); underTest = strategy; policy.setSlowConsumerStrategy(strategy); policy.setQueuePrefetch(10); policy.setTopicPrefetch(10); PolicyMap pMap = new PolicyMap(); pMap.setDefaultEntry(policy); broker.setDestinationPolicy(pMap); return broker; }
Example 4
Source File: AbortSlowConsumerBase.java From activemq-artemis with Apache License 2.0 | 6 votes |
@Override protected BrokerService createBroker() throws Exception { BrokerService broker = super.createBroker(); PolicyEntry policy = new PolicyEntry(); underTest.setAbortConnection(abortConnection); underTest.setCheckPeriod(checkPeriod); underTest.setMaxSlowDuration(maxSlowDuration); policy.setSlowConsumerStrategy(underTest); policy.setQueuePrefetch(10); policy.setTopicPrefetch(10); PolicyMap pMap = new PolicyMap(); pMap.setDefaultEntry(policy); broker.setDestinationPolicy(pMap); return broker; }
Example 5
Source File: UniquePropertyMessageEvictionStrategyTest.java From activemq-artemis with Apache License 2.0 | 5 votes |
@Override protected BrokerService createBroker() throws Exception { BrokerService broker = super.createBroker(); final List<PolicyEntry> policyEntries = new ArrayList<>(); final PolicyEntry entry = new PolicyEntry(); entry.setTopic(">"); entry.setAdvisoryForDiscardingMessages(true); entry.setTopicPrefetch(1); ConstantPendingMessageLimitStrategy pendingMessageLimitStrategy = new ConstantPendingMessageLimitStrategy(); pendingMessageLimitStrategy.setLimit(10); entry.setPendingMessageLimitStrategy(pendingMessageLimitStrategy); UniquePropertyMessageEvictionStrategy messageEvictionStrategy = new UniquePropertyMessageEvictionStrategy(); messageEvictionStrategy.setPropertyName("sequenceI"); entry.setMessageEvictionStrategy(messageEvictionStrategy); // let evicted messages disappear entry.setDeadLetterStrategy(null); policyEntries.add(entry); final PolicyMap policyMap = new PolicyMap(); policyMap.setPolicyEntries(policyEntries); broker.setDestinationPolicy(policyMap); return broker; }