当前位置: 首页>>代码示例>>Java>>正文


Java PolicyMap类代码示例

本文整理汇总了Java中org.apache.activemq.broker.region.policy.PolicyMap的典型用法代码示例。如果您正苦于以下问题:Java PolicyMap类的具体用法?Java PolicyMap怎么用?Java PolicyMap使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


PolicyMap类属于org.apache.activemq.broker.region.policy包,在下文中一共展示了PolicyMap类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: configureBroker

import org.apache.activemq.broker.region.policy.PolicyMap; //导入依赖的package包/类
@Override
protected void configureBroker(BrokerService broker) throws Exception {
    broker.setUseJmx(true);
    broker.setPersistent(true);
    broker.setDataDirectory("target/activemq-data");
    broker.deleteAllMessages();
    broker.setAdvisorySupport(true);
    broker.addConnector(brokerUri);

    // configure expiration rate
    ActiveMQQueue queueName = new ActiveMQQueue(">");
    PolicyEntry entry = new PolicyEntry();
    entry.setDestination(queueName);
    entry.setExpireMessagesPeriod(1000);

    PolicyMap policyMap = new PolicyMap();
    policyMap.put(queueName, entry);
    broker.setDestinationPolicy(policyMap);
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:20,代码来源:QueueProducerQoSTest.java

示例2: beforeTest

import org.apache.activemq.broker.region.policy.PolicyMap; //导入依赖的package包/类
/**
 * @throws Exception If failed.
 */
@Before
@SuppressWarnings("unchecked")
public void beforeTest() throws Exception {
    grid().<Integer, String>getOrCreateCache(defaultCacheConfiguration());

    broker = new BrokerService();
    broker.setDeleteAllMessagesOnStartup(true);
    broker.setPersistent(false);
    broker.setPersistenceAdapter(null);
    broker.setPersistenceFactory(null);

    PolicyMap plcMap = new PolicyMap();
    PolicyEntry plc = new PolicyEntry();

    plc.setQueuePrefetch(1);

    broker.setDestinationPolicy(plcMap);
    broker.getDestinationPolicy().setDefaultEntry(plc);
    broker.setSchedulerSupport(false);

    broker.start(true);

    connFactory = new ActiveMQConnectionFactory(BrokerRegistry.getInstance().findFirst().getVmConnectorURI());
}
 
开发者ID:apache,项目名称:ignite,代码行数:28,代码来源:IgniteJmsStreamerTest.java

示例3: configureBroker

import org.apache.activemq.broker.region.policy.PolicyMap; //导入依赖的package包/类
@Override
protected void configureBroker(BrokerService answer) throws Exception {
   answer.setPersistent(false);
   answer.setMonitorConnectionSplits(true);
   final List<PolicyEntry> policyEntries = new ArrayList<>();
   final PolicyEntry entry = new PolicyEntry();
   entry.setQueue(">");
   entry.setMemoryLimit(1024 * 1024 * 100); // Set to 1 MB
   entry.setOptimizedDispatch(true);
   entry.setProducerFlowControl(true);
   entry.setMaxPageSize(10);
   entry.setLazyDispatch(false);
   policyEntries.add(entry);

   final PolicyMap policyMap = new PolicyMap();
   policyMap.setPolicyEntries(policyEntries);
   answer.setDestinationPolicy(policyMap);
   super.configureBroker(answer);
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:20,代码来源:SimpleNonPersistentQueueNetworkTest.java

示例4: configureBroker

import org.apache.activemq.broker.region.policy.PolicyMap; //导入依赖的package包/类
@Override
protected void configureBroker(BrokerService answer, String uri) throws Exception {
   // answer.setPersistent(false);
   final List<PolicyEntry> policyEntries = new ArrayList<>();
   final PolicyEntry entry = new PolicyEntry();
   entry.setQueue(">");
   entry.setMemoryLimit(1024 * 1024 * 1); // Set to 1 MB
   entry.setOptimizedDispatch(true);
   entry.setLazyDispatch(true);
   policyEntries.add(entry);

   final PolicyMap policyMap = new PolicyMap();
   policyMap.setPolicyEntries(policyEntries);
   answer.setDestinationPolicy(policyMap);
   super.configureBroker(answer, uri);
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:17,代码来源:SimpleNonPersistentQueueTest.java

示例5: configureBroker

import org.apache.activemq.broker.region.policy.PolicyMap; //导入依赖的package包/类
protected void configureBroker(BrokerService answer) throws Exception {
   answer.setPersistent(false);
   ConstantPendingMessageLimitStrategy strategy = new ConstantPendingMessageLimitStrategy();
   strategy.setLimit(10);
   PolicyEntry tempQueueEntry = createPolicyEntry(strategy);
   tempQueueEntry.setTempQueue(true);
   PolicyEntry tempTopicEntry = createPolicyEntry(strategy);
   tempTopicEntry.setTempTopic(true);

   PolicyMap pMap = new PolicyMap();
   final List<PolicyEntry> policyEntries = new ArrayList<>();
   policyEntries.add(tempQueueEntry);
   policyEntries.add(tempTopicEntry);
   pMap.setPolicyEntries(policyEntries);

   answer.setDestinationPolicy(pMap);
   answer.addConnector(bindAddress);
   answer.setDeleteAllMessagesOnStartup(true);
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:20,代码来源:AdvisoryTempDestinationTests.java

示例6: configureBroker

import org.apache.activemq.broker.region.policy.PolicyMap; //导入依赖的package包/类
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);
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:21,代码来源:AdvisoryTests.java

示例7: createBroker

import org.apache.activemq.broker.region.policy.PolicyMap; //导入依赖的package包/类
@Override
protected BrokerService createBroker() throws Exception {
   BrokerService answer = BrokerFactory.createBroker(new URI("broker://nio://localhost:62621?useQueueForAccept=false&persistent=false&wiewformat.maxInactivityDuration=0"));
   answer.getManagementContext().setCreateConnector(false);
   answer.setUseJmx(false);
   answer.setDeleteAllMessagesOnStartup(true);
   final List<PolicyEntry> policyEntries = new ArrayList<>();
   final PolicyEntry entry = new PolicyEntry();
   entry.setQueue(">");
   entry.setOptimizedDispatch(true);
   policyEntries.add(entry);

   final PolicyMap policyMap = new PolicyMap();
   policyMap.setPolicyEntries(policyEntries);
   answer.setDestinationPolicy(policyMap);
   return answer;
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:18,代码来源:NioQueueSubscriptionTest.java

示例8: createBroker

import org.apache.activemq.broker.region.policy.PolicyMap; //导入依赖的package包/类
@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;
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:20,代码来源:AbortSlowAckConsumer1Test.java

示例9: createBroker

import org.apache.activemq.broker.region.policy.PolicyMap; //导入依赖的package包/类
@Override
protected BrokerService createBroker() throws Exception {
   BrokerService broker = super.createBroker();

   PolicyEntry policy = new PolicyEntry();
   IndividualDeadLetterStrategy strategy = new IndividualDeadLetterStrategy();
   strategy.setProcessNonPersistent(true);
   strategy.setDestinationPerDurableSubscriber(true);
   policy.setDeadLetterStrategy(strategy);

   PolicyMap pMap = new PolicyMap();
   pMap.setDefaultEntry(policy);

   broker.setDestinationPolicy(pMap);

   return broker;
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:18,代码来源:PerDurableConsumerDeadLetterTest.java

示例10: createBroker

import org.apache.activemq.broker.region.policy.PolicyMap; //导入依赖的package包/类
@Override
protected BrokerService createBroker() throws Exception {
   BrokerService broker = super.createBroker();

   PolicyEntry policy = new PolicyEntry();
   DeadLetterStrategy strategy = new IndividualDeadLetterStrategy();
   strategy.setProcessNonPersistent(true);
   policy.setDeadLetterStrategy(strategy);

   PolicyMap pMap = new PolicyMap();
   pMap.setDefaultEntry(policy);

   broker.setDestinationPolicy(pMap);

   return broker;
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:17,代码来源:IndividualDeadLetterTest.java

示例11: createBroker

import org.apache.activemq.broker.region.policy.PolicyMap; //导入依赖的package包/类
@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;
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:17,代码来源:AbortSlowAckConsumer0Test.java

示例12: 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;
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:17,代码来源:AbortSlowConsumerBase.java

示例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();
   DeadLetterStrategy strategy = new DiscardingDeadLetterStrategy();
   strategy.setProcessNonPersistent(true);
   policy.setDeadLetterStrategy(strategy);

   PolicyMap pMap = new PolicyMap();
   pMap.setDefaultEntry(policy);

   broker.setDestinationPolicy(pMap);

   return broker;
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:17,代码来源:DiscardingDeadLetterPolicyTest.java

示例14: 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;
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:20,代码来源:MessageGroupConfigTest.java

示例15: configureBroker

import org.apache.activemq.broker.region.policy.PolicyMap; //导入依赖的package包/类
protected void configureBroker(long memoryLimit, long systemLimit) throws Exception {
   broker.setDeleteAllMessagesOnStartup(true);
   broker.addConnector(bindAddress);
   broker.setPersistent(true);

   SystemUsage systemUsage = broker.getSystemUsage();
   systemUsage.setSendFailIfNoSpace(true);
   systemUsage.getMemoryUsage().setLimit(systemLimit);

   PolicyEntry policy = new PolicyEntry();
   policy.setProducerFlowControl(true);
   policy.setUseCache(true);
   PolicyMap pMap = new PolicyMap();
   pMap.setDefaultEntry(policy);
   broker.setDestinationPolicy(pMap);
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:17,代码来源:StoreBasedCursorTest.java


注:本文中的org.apache.activemq.broker.region.policy.PolicyMap类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。