Add a default policy entry, now that FixedSizeSubsctionRecoveryPolicy is no longer set by default on a Topic.

It was a memory issue for large messages.

git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@510899 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Davies 2007-02-23 10:46:43 +00:00
parent d85794c17f
commit f7e9206ae5
1 changed files with 17 additions and 1 deletions

View File

@ -30,6 +30,10 @@ import javax.jms.MessageNotWriteableException;
import org.apache.activemq.CombinationTestSupport; import org.apache.activemq.CombinationTestSupport;
import org.apache.activemq.broker.region.RegionBroker; import org.apache.activemq.broker.region.RegionBroker;
import org.apache.activemq.broker.region.policy.FixedCountSubscriptionRecoveryPolicy;
import org.apache.activemq.broker.region.policy.PolicyEntry;
import org.apache.activemq.broker.region.policy.PolicyMap;
import org.apache.activemq.broker.region.policy.RoundRobinDispatchPolicy;
import org.apache.activemq.command.ActiveMQDestination; import org.apache.activemq.command.ActiveMQDestination;
import org.apache.activemq.command.ActiveMQTextMessage; import org.apache.activemq.command.ActiveMQTextMessage;
import org.apache.activemq.command.ConnectionId; import org.apache.activemq.command.ConnectionId;
@ -79,11 +83,23 @@ public class BrokerTestSupport extends CombinationTestSupport {
protected void setUp() throws Exception { protected void setUp() throws Exception {
super.setUp(); super.setUp();
broker = createBroker(); broker = createBroker();
setDefaultPolicy(broker);
broker.start(); broker.start();
} }
protected void setDefaultPolicy(BrokerService brokerService) {
PolicyEntry policy = new PolicyEntry();
policy.setDispatchPolicy(new RoundRobinDispatchPolicy());
policy.setSubscriptionRecoveryPolicy(new FixedCountSubscriptionRecoveryPolicy());
PolicyMap pMap = new PolicyMap();
pMap.setDefaultEntry(policy);
broker.setDestinationPolicy(pMap);
}
protected BrokerService createBroker() throws Exception { protected BrokerService createBroker() throws Exception {
return BrokerFactory.createBroker(new URI("broker:()/localhost?persistent=false")); BrokerService broker = BrokerFactory.createBroker(new URI("broker:()/localhost?persistent=false"));
return broker;
} }
protected void tearDown() throws Exception { protected void tearDown() throws Exception {