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


Java AdvisorySupport.getDestinationAdvisoryTopic方法代码示例

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


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

示例1: tempQueueDeleted

import org.apache.activemq.advisory.AdvisorySupport; //导入方法依赖的package包/类
@Override
public void tempQueueDeleted(SimpleString bindingName) {
   ActiveMQDestination dest = new ActiveMQTempQueue(bindingName.toString());
   state.removeTempDestination(dest);

   if (!AdvisorySupport.isAdvisoryTopic(dest)) {
      AMQConnectionContext context = getContext();
      DestinationInfo advInfo = new DestinationInfo(context.getConnectionId(), DestinationInfo.REMOVE_OPERATION_TYPE, dest);

      ActiveMQTopic topic = AdvisorySupport.getDestinationAdvisoryTopic(dest);
      try {
         protocolManager.fireAdvisory(context, topic, advInfo);
      } catch (Exception e) {
         logger.warn("Failed to fire advisory on " + topic, e);
      }
   }
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:18,代码来源:OpenWireConnection.java

示例2: addDestination

import org.apache.activemq.advisory.AdvisorySupport; //导入方法依赖的package包/类
public void addDestination(DestinationInfo info) throws Exception {
   boolean created = false;
   ActiveMQDestination dest = info.getDestination();
   if (!protocolManager.isSupportAdvisory() && AdvisorySupport.isAdvisoryTopic(dest)) {
      return;
   }

   SimpleString qName = SimpleString.toSimpleString(dest.getPhysicalName());
   if (server.locateQueue(qName) == null) {
      AddressSettings addressSettings = server.getAddressSettingsRepository().getMatch(dest.getPhysicalName());
      AddressInfo addressInfo = new AddressInfo(qName, dest.isTopic() ? RoutingType.MULTICAST : RoutingType.ANYCAST);
      if (AdvisorySupport.isAdvisoryTopic(dest) && protocolManager.isSuppressInternalManagementObjects()) {
         addressInfo.setInternal(true);
      }
      if (dest.isQueue() && (addressSettings.isAutoCreateQueues() || dest.isTemporary())) {
         internalSession.createQueue(addressInfo, qName, null, dest.isTemporary(), !dest.isTemporary(), !dest.isTemporary());
         created = true;
      } else if (dest.isTopic() && (addressSettings.isAutoCreateAddresses() || dest.isTemporary())) {
         internalSession.createAddress(addressInfo, !dest.isTemporary());
         created = true;
      }
   }

   if (dest.isTemporary()) {
      //Openwire needs to store the DestinationInfo in order to send
      //Advisory messages to clients
      this.state.addTempDestination(info);
   }

   if (created && !AdvisorySupport.isAdvisoryTopic(dest)) {
      AMQConnectionContext context = getContext();
      DestinationInfo advInfo = new DestinationInfo(context.getConnectionId(), DestinationInfo.ADD_OPERATION_TYPE, dest);

      ActiveMQTopic topic = AdvisorySupport.getDestinationAdvisoryTopic(dest);
      protocolManager.fireAdvisory(context, topic, advInfo);
   }
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:38,代码来源:OpenWireConnection.java

示例3: removeDestination

import org.apache.activemq.advisory.AdvisorySupport; //导入方法依赖的package包/类
public void removeDestination(ActiveMQDestination dest) throws Exception {
   if (dest.isQueue()) {
      try {
         server.destroyQueue(new SimpleString(dest.getPhysicalName()));
      } catch (ActiveMQNonExistentQueueException neq) {
         //this is ok, ActiveMQ 5 allows this and will actually do it quite often
         ActiveMQServerLogger.LOGGER.debug("queue never existed");
      }


   } else {
      Bindings bindings = server.getPostOffice().getBindingsForAddress(new SimpleString(dest.getPhysicalName()));

      for (Binding binding : bindings.getBindings()) {
         Queue b = (Queue) binding.getBindable();
         if (b.getConsumerCount() > 0) {
            throw new Exception("Destination still has an active subscription: " + dest.getPhysicalName());
         }
         if (b.isDurable()) {
            throw new Exception("Destination still has durable subscription: " + dest.getPhysicalName());
         }
         b.deleteQueue();
      }
   }

   if (!AdvisorySupport.isAdvisoryTopic(dest)) {
      AMQConnectionContext context = getContext();
      DestinationInfo advInfo = new DestinationInfo(context.getConnectionId(), DestinationInfo.REMOVE_OPERATION_TYPE, dest);

      ActiveMQTopic topic = AdvisorySupport.getDestinationAdvisoryTopic(dest);
      protocolManager.fireAdvisory(context, topic, advInfo);
   }
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:34,代码来源:OpenWireConnection.java

示例4: addConsumer

import org.apache.activemq.advisory.AdvisorySupport; //导入方法依赖的package包/类
public void addConsumer(ConsumerInfo info) throws Exception {
   // Todo: add a destination interceptors holder here (amq supports this)
   SessionId sessionId = info.getConsumerId().getParentId();
   ConnectionId connectionId = sessionId.getParentId();
   ConnectionState cs = getState();
   if (cs == null) {
      throw new IllegalStateException("Cannot add a consumer to a connection that had not been registered: " + connectionId);
   }
   SessionState ss = cs.getSessionState(sessionId);
   if (ss == null) {
      throw new IllegalStateException(server + " Cannot add a consumer to a session that had not been registered: " + sessionId);
   }
   // Avoid replaying dup commands
   if (!ss.getConsumerIds().contains(info.getConsumerId())) {

      AMQSession amqSession = sessions.get(sessionId);
      if (amqSession == null) {
         throw new IllegalStateException("Session not exist! : " + sessionId);
      }

      List<AMQConsumer> consumersList = amqSession.createConsumer(info, new SlowConsumerDetection());
      if (consumersList.size() == 0) {
         return;
      }

      this.addConsumerBrokerExchange(info.getConsumerId(), amqSession, consumersList);
      ss.addConsumer(info);
      amqSession.start();

      if (AdvisorySupport.isAdvisoryTopic(info.getDestination())) {
         //advisory for temp destinations
         if (AdvisorySupport.isTempDestinationAdvisoryTopic(info.getDestination())) {
            // Replay the temporary destinations.
            List<DestinationInfo> tmpDests = this.protocolManager.getTemporaryDestinations();
            for (DestinationInfo di : tmpDests) {
               ActiveMQTopic topic = AdvisorySupport.getDestinationAdvisoryTopic(di.getDestination());
               String originalConnectionId = di.getConnectionId().getValue();
               protocolManager.fireAdvisory(context, topic, di, info.getConsumerId(), originalConnectionId);
            }
         }
      }
   }
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:44,代码来源:OpenWireConnection.java


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