本文整理汇总了Java中org.apache.activemq.broker.region.policy.PolicyMap.setDefaultEntry方法的典型用法代码示例。如果您正苦于以下问题:Java PolicyMap.setDefaultEntry方法的具体用法?Java PolicyMap.setDefaultEntry怎么用?Java PolicyMap.setDefaultEntry使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.activemq.broker.region.policy.PolicyMap
的用法示例。
在下文中一共展示了PolicyMap.setDefaultEntry方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createBroker
import org.apache.activemq.broker.region.policy.PolicyMap; //导入方法依赖的package包/类
@Override
protected BrokerService createBroker() throws Exception {
BrokerService service = new BrokerService();
service.setPersistent(false);
service.setUseJmx(false);
// Setup a destination policy where it takes only 1 message at a time.
PolicyMap policyMap = new PolicyMap();
PolicyEntry policy = new PolicyEntry();
log.info("testing with consumersBeforeDispatchStarts=" + consumersBeforeDispatchStarts + " and timeBeforeDispatchStarts=" + timeBeforeDispatchStarts);
policy.setConsumersBeforeDispatchStarts(consumersBeforeDispatchStarts);
policy.setTimeBeforeDispatchStarts(timeBeforeDispatchStarts);
policyMap.setDefaultEntry(policy);
service.setDestinationPolicy(policyMap);
connector = service.addConnector("tcp://localhost:0");
return service;
}
示例2: startBroker
import org.apache.activemq.broker.region.policy.PolicyMap; //导入方法依赖的package包/类
@Before
public void startBroker() throws Exception {
exceptions.clear();
for (int i = 0; i < MAX_MESSAGES; i++) {
dupChecker[i] = 0;
}
broker = new BrokerService();
broker.setAdvisorySupport(false);
broker.setPersistenceAdapter(new JDBCPersistenceAdapter());
PolicyEntry policyEntry = new PolicyEntry();
policyEntry.setMaxAuditDepth(3000);
policyEntry.setMaxPageSize(150);
policyEntry.setPrioritizedMessages(true);
PolicyMap policyMap = new PolicyMap();
policyMap.setDefaultEntry(policyEntry);
broker.setDestinationPolicy(policyMap);
broker.addConnector("tcp://localhost:0");
broker.setDeleteAllMessagesOnStartup(true);
broker.start();
broker.waitUntilStarted();
url = broker.getTransportConnectors().get(0).getConnectUri().toString() + "?" + urlOptions;
}
示例3: createBroker
import org.apache.activemq.broker.region.policy.PolicyMap; //导入方法依赖的package包/类
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();
}
示例4: setUp
import org.apache.activemq.broker.region.policy.PolicyMap; //导入方法依赖的package包/类
@Override
protected void setUp() throws Exception {
broker = new BrokerService();
broker.setPersistent(false);
// workaround is to ensure sufficient dispatch buffer for the destination
PolicyMap policyMap = new PolicyMap();
PolicyEntry defaultPolicy = new PolicyEntry();
defaultPolicy.setMaxPageSize(testSize);
policyMap.setDefaultEntry(defaultPolicy);
broker.setDestinationPolicy(policyMap);
broker.start();
super.setUp();
this.producerConnection = this.createConnection();
this.consumerConnection = this.createConnection();
}
示例5: createBroker
import org.apache.activemq.broker.region.policy.PolicyMap; //导入方法依赖的package包/类
@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;
}
示例6: doTestGroupConfiguration
import org.apache.activemq.broker.region.policy.PolicyMap; //导入方法依赖的package包/类
public MessageGroupMap doTestGroupConfiguration(String type, Class classType) throws Exception {
broker = new BrokerService();
PolicyEntry defaultEntry = new PolicyEntry();
defaultEntry.setMessageGroupMapFactoryType(type);
PolicyMap policyMap = new PolicyMap();
policyMap.setDefaultEntry(defaultEntry);
broker.setDestinationPolicy(policyMap);
broker.start();
super.topic = false;
ActiveMQDestination destination = (ActiveMQDestination) createDestination("org.apache.foo");
Queue brokerDestination = (Queue) broker.getDestination(destination);
assertNotNull(brokerDestination);
MessageGroupMap messageGroupMap = brokerDestination.getMessageGroupOwners();
assertNotNull(messageGroupMap);
assertTrue(messageGroupMap.getClass().isAssignableFrom(classType));
return messageGroupMap;
}
示例7: createBroker
import org.apache.activemq.broker.region.policy.PolicyMap; //导入方法依赖的package包/类
protected BrokerService createBroker() throws Exception {
BrokerService service = new BrokerService();
service.setAdvisorySupport(false);
service.setPersistent(false);
service.setUseJmx(true);
PolicyMap policyMap = new PolicyMap();
PolicyEntry policy = new PolicyEntry();
policy.setUseConsumerPriority(consumerPriority);
policy.setMessageGroupMapFactoryType("cached?cacheSize=" + (numConsumers - 1));
policyMap.setDefaultEntry(policy);
service.setDestinationPolicy(policyMap);
connector = service.addConnector("tcp://localhost:0");
return service;
}
示例8: startBroker
import org.apache.activemq.broker.region.policy.PolicyMap; //导入方法依赖的package包/类
public void startBroker() throws Exception{
//By default a broker always listens on vm://<broker name>
BrokerService broker = new BrokerService();
broker.setBrokerName("fast");
broker.getSystemUsage().getMemoryUsage().setLimit(64*1024*1024);
//Set the Destination policies
PolicyEntry policy = new PolicyEntry();
//set a memory limit of 4mb for each destination
policy.setMemoryLimit(4 * 1024 *1024);
//disable flow control
policy.setProducerFlowControl(false);
PolicyMap pMap = new PolicyMap();
//configure the policy
pMap.setDefaultEntry(policy);
broker.setDestinationPolicy(pMap);
broker.addConnector("tcp://localhost:61616");
broker.start();
}
示例9: startBroker
import org.apache.activemq.broker.region.policy.PolicyMap; //导入方法依赖的package包/类
@Before
public void startBroker() throws Exception {
brokerService = new BrokerService();
brokerService.setPersistent(false);
brokerService.setUseJmx(true);
brokerService.addConnector("tcp://localhost:61616");
PolicyEntry entry = new PolicyEntry();
entry.setPendingMessageLimitStrategy(new ConstantPendingMessageLimitStrategy() {
@Override
public int getLimit() {
return 0;
}
});
PolicyMap map = new PolicyMap();
map.setDefaultEntry(entry);
brokerService.setDestinationPolicy(map);
brokerService.start();
brokerService.waitUntilStarted();
activeMQJmxMonitor = new ActiveMQJmxMonitor("service:jmx:rmi:///jndi/rmi://localhost:1099/jmxrmi", "localhost", null);
}
示例10: setDestinationPolicy
import org.apache.activemq.broker.region.policy.PolicyMap; //导入方法依赖的package包/类
@Override
protected void setDestinationPolicy(BrokerService broker, PolicyMap pm) {
PolicyEntry tpe = new PolicyEntry();
tpe.setTempTopic(true);
tpe.setMemoryLimit(destinationMemLimit);
tpe.setProducerFlowControl(true);
tpe.setAdvisoryWhenFull(true);
pm.setDefaultEntry(tpe);
broker.setDestinationPolicy(pm);
}
示例11: configureBroker
import org.apache.activemq.broker.region.policy.PolicyMap; //导入方法依赖的package包/类
private void configureBroker(BrokerService broker) {
PolicyMap policyMap = new PolicyMap();
PolicyEntry defaultEntry = new PolicyEntry();
defaultEntry.setExpireMessagesPeriod(0);
ConditionalNetworkBridgeFilterFactory filterFactory = new ConditionalNetworkBridgeFilterFactory();
filterFactory.setReplayWhenNoConsumers(true);
defaultEntry.setNetworkBridgeFilterFactory(filterFactory);
policyMap.setDefaultEntry(defaultEntry);
broker.setDestinationPolicy(policyMap);
}
示例12: createBroker
import org.apache.activemq.broker.region.policy.PolicyMap; //导入方法依赖的package包/类
protected void createBroker(boolean deleteAllMessages) throws Exception {
String currentTestName = getName(true);
broker = BrokerFactory.createBroker("broker:(vm://" + currentTestName + ")");
broker.setBrokerName(currentTestName);
broker.setDeleteAllMessagesOnStartup(deleteAllMessages);
broker.getManagementContext().setCreateConnector(false);
broker.setAdvisorySupport(false);
broker.setKeepDurableSubsActive(keepDurableSubsActive);
broker.addConnector("tcp://0.0.0.0:0");
if (usePrioritySupport) {
PolicyEntry policy = new PolicyEntry();
policy.setPrioritizedMessages(true);
PolicyMap policyMap = new PolicyMap();
policyMap.setDefaultEntry(policy);
broker.setDestinationPolicy(policyMap);
}
setDefaultPersistenceAdapter(broker);
if (broker.getPersistenceAdapter() instanceof JDBCPersistenceAdapter) {
// ensure it kicks in during tests
((JDBCPersistenceAdapter) broker.getPersistenceAdapter()).setCleanupPeriod(2 * 1000);
} else if (broker.getPersistenceAdapter() instanceof KahaDBPersistenceAdapter) {
// have lots of journal files
((KahaDBPersistenceAdapter) broker.getPersistenceAdapter()).setJournalMaxFileLength(journalMaxFileLength);
}
broker.start();
broker.waitUntilStarted();
}
示例13: createBroker
import org.apache.activemq.broker.region.policy.PolicyMap; //导入方法依赖的package包/类
@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;
}
示例14: createBroker
import org.apache.activemq.broker.region.policy.PolicyMap; //导入方法依赖的package包/类
protected BrokerService createBroker() throws Exception {
BrokerService broker = new BrokerService();
broker.setPersistent(false);
PolicyEntry policy = new PolicyEntry();
DeadLetterStrategy defaultDeadLetterStrategy = policy.getDeadLetterStrategy();
if (defaultDeadLetterStrategy != null) {
defaultDeadLetterStrategy.setProcessNonPersistent(true);
}
PolicyMap pMap = new PolicyMap();
pMap.setDefaultEntry(policy);
broker.setDestinationPolicy(pMap);
return broker;
}
示例15: createBroker
import org.apache.activemq.broker.region.policy.PolicyMap; //导入方法依赖的package包/类
@Override
protected BrokerService createBroker() throws Exception {
BrokerService brokerService = super.createBroker();
PolicyMap policyMap = new PolicyMap();
PolicyEntry policyEntry = new PolicyEntry();
policyEntry.setUseCache(isUseCache);
policyEntry.setMaxBrowsePageSize(4096);
policyMap.setDefaultEntry(policyEntry);
brokerService.setDestinationPolicy(policyMap);
return brokerService;
}