本文整理汇总了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();
}
}
}
示例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);
}