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


Java BrokerService.getRegionBroker方法代码示例

本文整理汇总了Java中org.apache.activemq.broker.BrokerService.getRegionBroker方法的典型用法代码示例。如果您正苦于以下问题:Java BrokerService.getRegionBroker方法的具体用法?Java BrokerService.getRegionBroker怎么用?Java BrokerService.getRegionBroker使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.activemq.broker.BrokerService的用法示例。


在下文中一共展示了BrokerService.getRegionBroker方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: BaseDestination

import org.apache.activemq.broker.BrokerService; //导入方法依赖的package包/类
/**
 * @param brokerService
 * @param store
 * @param destination
 * @param parentStats
 * @throws Exception
 */
public BaseDestination(BrokerService brokerService, MessageStore store, ActiveMQDestination destination, DestinationStatistics parentStats) throws Exception {
    this.brokerService = brokerService;
    this.broker = brokerService.getBroker();
    this.store = store;
    this.destination = destination;
    // let's copy the enabled property from the parent DestinationStatistics
    this.destinationStatistics.setEnabled(parentStats.isEnabled());
    this.destinationStatistics.setParent(parentStats);
    this.systemUsage = new SystemUsage(brokerService.getProducerSystemUsage(), destination.toString());
    this.memoryUsage = this.systemUsage.getMemoryUsage();
    this.memoryUsage.setUsagePortion(1.0f);
    this.regionBroker = brokerService.getRegionBroker();
    this.scheduler = brokerService.getBroker().getScheduler();
}
 
开发者ID:DiamondLightSource,项目名称:daq-eclipse,代码行数:22,代码来源:BaseDestination.java

示例2: getDestinationMap

import org.apache.activemq.broker.BrokerService; //导入方法依赖的package包/类
private static Map<ActiveMQDestination, org.apache.activemq.broker.region.Destination> getDestinationMap(
   BrokerService target,
   ActiveMQDestination destination) {
   RegionBroker regionBroker = (RegionBroker) target.getRegionBroker();
   if (destination.isTemporary()) {
      return destination.isQueue() ? regionBroker.getTempQueueRegion().getDestinationMap() : regionBroker.getTempTopicRegion().getDestinationMap();
   }
   return destination.isQueue() ? regionBroker.getQueueRegion().getDestinationMap() : regionBroker.getTopicRegion().getDestinationMap();
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:10,代码来源:TestSupport.java

示例3: verifyConsumerCount

import org.apache.activemq.broker.BrokerService; //导入方法依赖的package包/类
private void verifyConsumerCount(BrokerService broker, int count, final Destination dest) throws Exception {
   final RegionBroker regionBroker = (RegionBroker) broker.getRegionBroker();
   waitFor(new Condition() {
      @Override
      public boolean isSatisified() throws Exception {
         return !regionBroker.getDestinations(ActiveMQDestination.transform(dest)).isEmpty();
      }
   });
   Queue internalQueue = (Queue) regionBroker.getDestinations(ActiveMQDestination.transform(dest)).iterator().next();
   LOG.info("Verify: consumer count on " + broker.getBrokerName() + " matches:" + count + ", val:" + internalQueue.getConsumers().size());
   assertEquals("consumer count on " + broker.getBrokerName() + " matches for q: " + internalQueue, count, internalQueue.getConsumers().size());
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:13,代码来源:ThreeBrokerQueueNetworkTest.java

示例4: logConsumerCount

import org.apache.activemq.broker.BrokerService; //导入方法依赖的package包/类
private void logConsumerCount(BrokerService broker, int count, final Destination dest) throws Exception {
   final RegionBroker regionBroker = (RegionBroker) broker.getRegionBroker();
   waitFor(new Condition() {
      @Override
      public boolean isSatisified() throws Exception {
         return !regionBroker.getDestinations(ActiveMQDestination.transform(dest)).isEmpty();
      }
   });
   Queue internalQueue = (Queue) regionBroker.getDestinations(ActiveMQDestination.transform(dest)).iterator().next();
   LOG.info("Verify: consumer count on " + broker.getBrokerName() + " matches:" + count + ", val:" + internalQueue.getConsumers().size());
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:12,代码来源:ThreeBrokerQueueNetworkTest.java

示例5: verifyConsumePriority

import org.apache.activemq.broker.BrokerService; //导入方法依赖的package包/类
private void verifyConsumePriority(BrokerService broker, byte expectedPriority, Destination dest) throws Exception {
   RegionBroker regionBroker = (RegionBroker) broker.getRegionBroker();
   Queue internalQueue = (Queue) regionBroker.getDestinations(ActiveMQDestination.transform(dest)).iterator().next();
   for (Subscription consumer : internalQueue.getConsumers()) {
      assertEquals("consumer on " + broker.getBrokerName() + " matches priority: " + internalQueue, expectedPriority, consumer.getConsumerInfo().getPriority());
   }
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:8,代码来源:ThreeBrokerQueueNetworkTest.java

示例6: testQueueNetworkWithConsumerFull

import org.apache.activemq.broker.BrokerService; //导入方法依赖的package包/类
public void testQueueNetworkWithConsumerFull() throws Exception {

      bridgeAllBrokers();
      startAllBrokers();

      Destination dest = createDestination("TEST.FOO", false);

      sendMessages("Broker1", dest, 50);

      CountDownLatch latch = new CountDownLatch(MESSAGE_COUNT);
      createConsumer("Broker2", dest, latch);
      assertConsumersConnect("Broker1", dest, 1, 30000);
      sendMessages("Broker1", dest, MESSAGE_COUNT - 50);

      // Wait for messages to be delivered
      assertTrue("Missing " + latch.getCount() + " messages", latch.await(45, TimeUnit.SECONDS));

      // verify stats, all messages acked
      BrokerService broker1 = brokers.get("Broker1").broker;
      RegionBroker regionBroker = (RegionBroker) broker1.getRegionBroker();
      // give the acks a chance to flow
      Thread.sleep(2000);
      Queue internalQueue = (Queue) regionBroker.getDestinations(ActiveMQDestination.transform(dest)).iterator().next();

      assertTrue("All messages are consumed and acked from source:" + internalQueue, internalQueue.getMessages().isEmpty());
      assertEquals("messages source:" + internalQueue, 0, internalQueue.getDestinationStatistics().getMessages().getCount());
      assertEquals("inflight source:" + internalQueue, 0, internalQueue.getDestinationStatistics().getInflight().getCount());
   }
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:29,代码来源:QueueMemoryFullMultiBrokersTest.java

示例7: doTestNonAdvisoryNetworkRequestReply

import org.apache.activemq.broker.BrokerService; //导入方法依赖的package包/类
public void doTestNonAdvisoryNetworkRequestReply() throws Exception {

      waitForBridgeFormation(a, 1, 0);
      waitForBridgeFormation(b, 1, 0);

      ActiveMQConnectionFactory sendFactory = createConnectionFactory(a);
      ActiveMQConnection sendConnection = createConnection(sendFactory);

      ActiveMQSession sendSession = (ActiveMQSession) sendConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
      MessageProducer producer = sendSession.createProducer(sendQ);
      ActiveMQTempQueue realReplyQ = (ActiveMQTempQueue) sendSession.createTemporaryQueue();
      TextMessage message = sendSession.createTextMessage("1");
      message.setJMSReplyTo(realReplyQ);
      producer.send(message);
      LOG.info("request sent");

      // responder
      ActiveMQConnectionFactory consumerFactory = createConnectionFactory(b);
      ActiveMQConnection consumerConnection = createConnection(consumerFactory);

      ActiveMQSession consumerSession = (ActiveMQSession) consumerConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
      MessageConsumer consumer = consumerSession.createConsumer(sendQ);
      TextMessage received = (TextMessage) consumer.receive(receiveTimeout);
      assertNotNull("got request from sender ok", received);

      LOG.info("got request, sending reply");

      MessageProducer consumerProducer = consumerSession.createProducer(received.getJMSReplyTo());
      consumerProducer.send(consumerSession.createTextMessage("got " + received.getText()));
      // temp dest on reply broker tied to this connection, setOptimizedDispatch=true ensures
      // message gets delivered before destination is removed
      consumerConnection.close();

      // reply consumer
      MessageConsumer replyConsumer = sendSession.createConsumer(realReplyQ);
      TextMessage reply = (TextMessage) replyConsumer.receive(receiveTimeout);
      assertNotNull("expected reply message", reply);
      assertEquals("text is as expected", "got 1", reply.getText());
      sendConnection.close();

      LOG.info("checking for dangling temp destinations");
      // ensure all temp dests get cleaned up on all brokers
      for (BrokerService brokerService : brokers) {
         final RegionBroker regionBroker = (RegionBroker) brokerService.getRegionBroker();
         assertTrue("all temps are gone on " + regionBroker.getBrokerName(), Wait.waitFor(new Wait.Condition() {
            @Override
            public boolean isSatisified() throws Exception {
               Map<?, ?> tempTopics = regionBroker.getTempTopicRegion().getDestinationMap();
               LOG.info("temp topics on " + regionBroker.getBrokerName() + ", " + tempTopics);
               Map<?, ?> tempQ = regionBroker.getTempQueueRegion().getDestinationMap();
               LOG.info("temp queues on " + regionBroker.getBrokerName() + ", " + tempQ);
               return tempQ.isEmpty() && tempTopics.isEmpty();
            }
         }));
      }
   }
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:57,代码来源:RequestReplyNoAdvisoryNetworkTest.java


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