本文整理汇总了Java中org.apache.activemq.command.ConsumerInfo.setPriority方法的典型用法代码示例。如果您正苦于以下问题:Java ConsumerInfo.setPriority方法的具体用法?Java ConsumerInfo.setPriority怎么用?Java ConsumerInfo.setPriority使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.activemq.command.ConsumerInfo
的用法示例。
在下文中一共展示了ConsumerInfo.setPriority方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testRemoveLowerPriorityDup
import org.apache.activemq.command.ConsumerInfo; //导入方法依赖的package包/类
@Test
public void testRemoveLowerPriorityDup() throws Exception {
List<Subscription> consumers = new ArrayList<>();
for (int i = 0; i < 3; i++) {
ConsumerInfo instance = info.copy();
instance.setPriority((byte) i);
consumers.add(new TopicSubscription(brokerService.getBroker(), context, instance, usageManager));
}
underTest.dispatch(node, null, consumers);
long count = 0;
for (Subscription consumer : consumers) {
count += consumer.getEnqueueCounter();
}
assertEquals("only one sub got message", 1, count);
}
示例2: startBridge
import org.apache.activemq.command.ConsumerInfo; //导入方法依赖的package包/类
/**
* @throws IOException
*/
final void startBridge() throws IOException {
connectionInfo = new ConnectionInfo();
connectionInfo.setConnectionId(new ConnectionId(ID_GENERATOR.generateId()));
connectionInfo.setClientId(clientId);
localBroker.oneway(connectionInfo);
remoteBroker.oneway(connectionInfo);
sessionInfo = new SessionInfo(connectionInfo, 1);
localBroker.oneway(sessionInfo);
remoteBroker.oneway(sessionInfo);
queueConsumerInfo = new ConsumerInfo(sessionInfo, 1);
queueConsumerInfo.setDispatchAsync(dispatchAsync);
queueConsumerInfo.setDestination(new ActiveMQQueue(destinationFilter));
queueConsumerInfo.setPrefetchSize(prefetchSize);
queueConsumerInfo.setPriority(ConsumerInfo.NETWORK_CONSUMER_PRIORITY);
localBroker.oneway(queueConsumerInfo);
producerInfo = new ProducerInfo(sessionInfo, 1);
producerInfo.setResponseRequired(false);
remoteBroker.oneway(producerInfo);
if (connectionInfo.getClientId() != null) {
topicConsumerInfo = new ConsumerInfo(sessionInfo, 2);
topicConsumerInfo.setDispatchAsync(dispatchAsync);
topicConsumerInfo.setSubscriptionName("topic-bridge");
topicConsumerInfo.setRetroactive(true);
topicConsumerInfo.setDestination(new ActiveMQTopic(destinationFilter));
topicConsumerInfo.setPrefetchSize(prefetchSize);
topicConsumerInfo.setPriority(ConsumerInfo.NETWORK_CONSUMER_PRIORITY);
localBroker.oneway(topicConsumerInfo);
}
LOG.info("Network connection between {} and {} has been established.", localBroker, remoteBroker);
}
示例3: populateObject
import org.apache.activemq.command.ConsumerInfo; //导入方法依赖的package包/类
@Override
protected void populateObject(Object object) throws Exception {
super.populateObject(object);
ConsumerInfo info = (ConsumerInfo) object;
info.setConsumerId(createConsumerId("ConsumerId:1"));
info.setBrowser(true);
info.setDestination(createActiveMQDestination("Destination:2"));
info.setPrefetchSize(1);
info.setMaximumPendingMessageLimit(2);
info.setDispatchAsync(false);
info.setSelector("Selector:3");
info.setSubscriptionName("SubcriptionName:4");
info.setNoLocal(true);
info.setExclusive(false);
info.setRetroactive(true);
info.setPriority((byte) 1);
{
BrokerId value[] = new BrokerId[2];
for (int i = 0; i < 2; i++) {
value[i] = createBrokerId("BrokerPath:5");
}
info.setBrokerPath(value);
}
info.setAdditionalPredicate(createBooleanExpression("AdditionalPredicate:6"));
info.setNetworkSubscription(false);
info.setOptimizedAcknowledge(true);
info.setNoRangeAcks(false);
}
示例4: populateObject
import org.apache.activemq.command.ConsumerInfo; //导入方法依赖的package包/类
@Override
protected void populateObject(Object object) throws Exception {
super.populateObject(object);
ConsumerInfo info = (ConsumerInfo) object;
info.setConsumerId(createConsumerId("ConsumerId:1"));
info.setBrowser(true);
info.setDestination(createActiveMQDestination("Destination:2"));
info.setPrefetchSize(1);
info.setMaximumPendingMessageLimit(2);
info.setDispatchAsync(false);
info.setSelector("Selector:3");
info.setSubscriptionName("SubscriptionName:4");
info.setNoLocal(true);
info.setExclusive(false);
info.setRetroactive(true);
info.setPriority((byte) 1);
{
BrokerId value[] = new BrokerId[2];
for (int i = 0; i < 2; i++) {
value[i] = createBrokerId("BrokerPath:5");
}
info.setBrokerPath(value);
}
info.setAdditionalPredicate(createBooleanExpression("AdditionalPredicate:6"));
info.setNetworkSubscription(false);
info.setOptimizedAcknowledge(true);
info.setNoRangeAcks(false);
}
示例5: tightUnmarshal
import org.apache.activemq.command.ConsumerInfo; //导入方法依赖的package包/类
/**
* Un-marshal an object instance from the data input stream
*
* @param o the object to un-marshal
* @param dataIn the data input stream to build the object from
* @throws IOException
*/
public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs)
throws IOException {
super.tightUnmarshal(wireFormat, o, dataIn, bs);
ConsumerInfo info = (ConsumerInfo)o;
info.setConsumerId((org.apache.activemq.command.ConsumerId)tightUnmarsalCachedObject(wireFormat,
dataIn, bs));
info.setBrowser(bs.readBoolean());
info
.setDestination((org.apache.activemq.command.ActiveMQDestination)tightUnmarsalCachedObject(
wireFormat,
dataIn,
bs));
info.setPrefetchSize(dataIn.readInt());
info.setMaximumPendingMessageLimit(dataIn.readInt());
info.setDispatchAsync(bs.readBoolean());
info.setSelector(tightUnmarshalString(dataIn, bs));
info.setSubscriptionName(tightUnmarshalString(dataIn, bs));
info.setNoLocal(bs.readBoolean());
info.setExclusive(bs.readBoolean());
info.setRetroactive(bs.readBoolean());
info.setPriority(dataIn.readByte());
if (bs.readBoolean()) {
short size = dataIn.readShort();
org.apache.activemq.command.BrokerId value[] = new org.apache.activemq.command.BrokerId[size];
for (int i = 0; i < size; i++) {
value[i] = (org.apache.activemq.command.BrokerId)tightUnmarsalNestedObject(wireFormat,
dataIn, bs);
}
info.setBrokerPath(value);
} else {
info.setBrokerPath(null);
}
info
.setAdditionalPredicate((org.apache.activemq.filter.BooleanExpression)tightUnmarsalNestedObject(
wireFormat,
dataIn,
bs));
info.setNetworkSubscription(bs.readBoolean());
info.setOptimizedAcknowledge(bs.readBoolean());
info.setNoRangeAcks(bs.readBoolean());
}
示例6: looseUnmarshal
import org.apache.activemq.command.ConsumerInfo; //导入方法依赖的package包/类
/**
* Un-marshal an object instance from the data input stream
*
* @param o the object to un-marshal
* @param dataIn the data input stream to build the object from
* @throws IOException
*/
public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException {
super.looseUnmarshal(wireFormat, o, dataIn);
ConsumerInfo info = (ConsumerInfo)o;
info.setConsumerId((org.apache.activemq.command.ConsumerId)looseUnmarsalCachedObject(wireFormat,
dataIn));
info.setBrowser(dataIn.readBoolean());
info
.setDestination((org.apache.activemq.command.ActiveMQDestination)looseUnmarsalCachedObject(
wireFormat,
dataIn));
info.setPrefetchSize(dataIn.readInt());
info.setMaximumPendingMessageLimit(dataIn.readInt());
info.setDispatchAsync(dataIn.readBoolean());
info.setSelector(looseUnmarshalString(dataIn));
info.setSubscriptionName(looseUnmarshalString(dataIn));
info.setNoLocal(dataIn.readBoolean());
info.setExclusive(dataIn.readBoolean());
info.setRetroactive(dataIn.readBoolean());
info.setPriority(dataIn.readByte());
if (dataIn.readBoolean()) {
short size = dataIn.readShort();
org.apache.activemq.command.BrokerId value[] = new org.apache.activemq.command.BrokerId[size];
for (int i = 0; i < size; i++) {
value[i] = (org.apache.activemq.command.BrokerId)looseUnmarsalNestedObject(wireFormat, dataIn);
}
info.setBrokerPath(value);
} else {
info.setBrokerPath(null);
}
info
.setAdditionalPredicate((org.apache.activemq.filter.BooleanExpression)looseUnmarsalNestedObject(
wireFormat,
dataIn));
info.setNetworkSubscription(dataIn.readBoolean());
info.setOptimizedAcknowledge(dataIn.readBoolean());
info.setNoRangeAcks(dataIn.readBoolean());
}