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


Java ClientMessage.getLongProperty方法代码示例

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


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

示例1: run

import org.apache.activemq.artemis.api.core.client.ClientMessage; //导入方法依赖的package包/类
@Override
public void run() {
   super.run();

   while (running) {
      try {
         beginTX();

         for (int i = 0; i < 1000; i++) {
            ClientMessage msg = cons.receive(5000);
            if (msg == null) {
               break;
            }

            msg.acknowledge();

            if (msg.getLongProperty("count") != msgs + pendingMsgs) {
               errors++;
               System.out.println("count should be " + (msgs + pendingMsgs) + " when it was " + msg.getLongProperty("count") + " on " + queue);
            }

            pendingMsgs++;
            if (!minConsume.tryAcquire(1, 5, TimeUnit.SECONDS)) {
               break;
            }

         }

         endTX();
      } catch (Exception e) {
         connect();
      }

   }
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:36,代码来源:Receiver.java

示例2: doBindingAdded

import org.apache.activemq.artemis.api.core.client.ClientMessage; //导入方法依赖的package包/类
private synchronized void doBindingAdded(final ClientMessage message) throws Exception {
   if (logger.isTraceEnabled()) {
      logger.trace(ClusterConnectionImpl.this + " Adding binding " + message);
   }
   if (!message.containsProperty(ManagementHelper.HDR_DISTANCE)) {
      throw new IllegalStateException("distance is null");
   }

   if (!message.containsProperty(ManagementHelper.HDR_ADDRESS)) {
      throw new IllegalStateException("queueAddress is null");
   }

   if (!message.containsProperty(ManagementHelper.HDR_CLUSTER_NAME)) {
      throw new IllegalStateException("clusterName is null");
   }

   if (!message.containsProperty(ManagementHelper.HDR_ROUTING_NAME)) {
      throw new IllegalStateException("routingName is null");
   }

   if (!message.containsProperty(ManagementHelper.HDR_BINDING_ID)) {
      throw new IllegalStateException("queueID is null");
   }

   Integer distance = message.getIntProperty(ManagementHelper.HDR_DISTANCE);

   SimpleString queueAddress = message.getSimpleStringProperty(ManagementHelper.HDR_ADDRESS);

   SimpleString clusterName = message.getSimpleStringProperty(ManagementHelper.HDR_CLUSTER_NAME);

   SimpleString routingName = message.getSimpleStringProperty(ManagementHelper.HDR_ROUTING_NAME);

   SimpleString filterString = message.getSimpleStringProperty(ManagementHelper.HDR_FILTERSTRING);

   Long queueID = message.getLongProperty(ManagementHelper.HDR_BINDING_ID);

   RemoteQueueBinding existingBinding = (RemoteQueueBinding) postOffice.getBinding(clusterName);

   if (existingBinding != null) {
      if (!existingBinding.isConnected()) {
         existingBinding.connect();
         return;
      }
      // Sanity check - this means the binding has already been added via another bridge, probably max
      // hops is too high
      // or there are multiple cluster connections for the same address

      ActiveMQServerLogger.LOGGER.remoteQueueAlreadyBoundOnClusterConnection(this, clusterName);

      return;
   }

   RemoteQueueBinding binding = new RemoteQueueBindingImpl(server.getStorageManager().generateID(), queueAddress, clusterName, routingName, queueID, filterString, queue, bridge.getName(), distance + 1);

   if (logger.isTraceEnabled()) {
      logger.trace("Adding binding " + clusterName + " into " + ClusterConnectionImpl.this);
   }

   bindings.put(clusterName, binding);

   try {
      postOffice.addBinding(binding);
   } catch (Exception ignore) {
   }

   Bindings theBindings = postOffice.getBindingsForAddress(queueAddress);

   theBindings.setMessageLoadBalancingType(messageLoadBalancingType);

}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:71,代码来源:ClusterConnectionImpl.java


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