當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。