Java Code Examples for org.apache.activemq.broker.region.policy.PolicyEntry#setAdvisoryForSlowConsumers()

The following examples show how to use org.apache.activemq.broker.region.policy.PolicyEntry#setAdvisoryForSlowConsumers() . 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: AdvisoryTests.java    From activemq-artemis with Apache License 2.0 6 votes vote down vote up
protected void configureBroker(BrokerService answer) throws Exception {
   answer.setPersistent(false);
   PolicyEntry policy = new PolicyEntry();
   policy.setAdvisoryForFastProducers(true);
   policy.setAdvisoryForConsumed(true);
   policy.setAdvisoryForDelivery(true);
   policy.setAdvisoryForDiscardingMessages(true);
   policy.setAdvisoryForSlowConsumers(true);
   policy.setAdvisoryWhenFull(true);
   policy.setProducerFlowControl(false);
   ConstantPendingMessageLimitStrategy strategy = new ConstantPendingMessageLimitStrategy();
   strategy.setLimit(10);
   policy.setPendingMessageLimitStrategy(strategy);
   PolicyMap pMap = new PolicyMap();
   pMap.setDefaultEntry(policy);

   answer.setDestinationPolicy(pMap);
   answer.addConnector(bindAddress);
   answer.setDeleteAllMessagesOnStartup(true);
}
 
Example 2
Source File: TopicSubscriptionSlowConsumerTest.java    From activemq-artemis with Apache License 2.0 6 votes vote down vote up
private BrokerService createBroker() throws Exception {
   BrokerService broker = new BrokerService();
   broker.setBrokerName("localhost");
   broker.setUseJmx(true);
   broker.setDeleteAllMessagesOnStartup(true);
   broker.addConnector("vm://localhost");

   PolicyMap policyMap = new PolicyMap();
   PolicyEntry defaultEntry = new PolicyEntry();
   defaultEntry.setAdvisoryForSlowConsumers(true);

   policyMap.setDefaultEntry(defaultEntry);

   broker.setDestinationPolicy(policyMap);
   broker.start();
   broker.waitUntilStarted();
   return broker;
}
 
Example 3
Source File: AdvisoryTopicCleanUpTest.java    From activemq-artemis with Apache License 2.0 6 votes vote down vote up
private void createBroker() throws Exception {
   broker = new BrokerService();
   broker.setPersistent(false);
   broker.setDeleteAllMessagesOnStartup(true);
   broker.setUseJmx(true);
   connectionUri = broker.addConnector("tcp://localhost:0").getPublishableConnectString();

   PolicyEntry policy = new PolicyEntry();
   policy.setAdvisoryForFastProducers(true);
   policy.setAdvisoryForConsumed(true);
   policy.setAdvisoryForDelivery(true);
   policy.setAdvisoryForDiscardingMessages(true);
   policy.setAdvisoryForSlowConsumers(true);
   policy.setAdvisoryWhenFull(true);
   policy.setProducerFlowControl(false);
   PolicyMap pMap = new PolicyMap();
   pMap.setDefaultEntry(policy);
   broker.setDestinationPolicy(pMap);

   broker.start();
}
 
Example 4
Source File: AdvisoryTempDestinationTests.java    From activemq-artemis with Apache License 2.0 5 votes vote down vote up
private PolicyEntry createPolicyEntry(ConstantPendingMessageLimitStrategy strategy) {
   PolicyEntry policy = new PolicyEntry();
   policy.setAdvisoryForFastProducers(true);
   policy.setAdvisoryForConsumed(true);
   policy.setAdvisoryForDelivery(true);
   policy.setAdvisoryForDiscardingMessages(true);
   policy.setAdvisoryForSlowConsumers(true);
   policy.setAdvisoryWhenFull(true);
   policy.setProducerFlowControl(false);
   policy.setPendingMessageLimitStrategy(strategy);

   return policy;
}