本文整理汇总了Java中org.apache.activemq.command.ConsumerInfo.setDispatchAsync方法的典型用法代码示例。如果您正苦于以下问题:Java ConsumerInfo.setDispatchAsync方法的具体用法?Java ConsumerInfo.setDispatchAsync怎么用?Java ConsumerInfo.setDispatchAsync使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.activemq.command.ConsumerInfo
的用法示例。
在下文中一共展示了ConsumerInfo.setDispatchAsync方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onSubscribe
import org.apache.activemq.command.ConsumerInfo; //导入方法依赖的package包/类
QoS onSubscribe(SUBSCRIBE command, Topic topic) throws MQTTProtocolException {
ActiveMQDestination destination = new ActiveMQTopic(convertMQTTToActiveMQ(topic.name().toString()));
ConsumerId id = new ConsumerId(sessionId, consumerIdGenerator.getNextSequenceId());
ConsumerInfo consumerInfo = new ConsumerInfo(id);
consumerInfo.setDestination(destination);
consumerInfo.setPrefetchSize(getActiveMQSubscriptionPrefetch());
consumerInfo.setDispatchAsync(true);
if (!connect.cleanSession() && (connect.clientId() != null)) {
//by default subscribers are persistent
consumerInfo.setSubscriptionName(
connect.clientId().toString() + topic.name().toString());
}
MQTTSubscription mqttSubscription = new MQTTSubscription(this, topic.qos(), consumerInfo);
subscriptionsByConsumerId.put(id, mqttSubscription);
mqttSubscriptionByTopic.put(topic.name(), mqttSubscription);
sendToActiveMQ(consumerInfo, null);
return topic.qos();
}
示例2: createConnectionConsumer
import org.apache.activemq.command.ConsumerInfo; //导入方法依赖的package包/类
public ConnectionConsumer createConnectionConsumer(Destination destination, String messageSelector, ServerSessionPool sessionPool, int maxMessages, boolean noLocal)
throws JMSException {
checkClosedOrFailed();
ensureConnectionInfoSent();
ConsumerId consumerId = createConsumerId();
ConsumerInfo consumerInfo = new ConsumerInfo(consumerId);
consumerInfo.setDestination(ActiveMQMessageTransformation.transformDestination(destination));
consumerInfo.setSelector(messageSelector);
consumerInfo.setPrefetchSize(maxMessages);
consumerInfo.setNoLocal(noLocal);
consumerInfo.setDispatchAsync(isDispatchAsync());
// Allows the options on the destination to configure the consumerInfo
if (consumerInfo.getDestination().getOptions() != null) {
Map<String, String> options = new HashMap<String, String>(consumerInfo.getDestination().getOptions());
IntrospectionSupport.setProperties(consumerInfo, options, "consumer.");
}
return new ActiveMQConnectionConsumer(this, sessionPool, consumerInfo);
}
示例3: 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);
}
示例4: AdvisoryConsumer
import org.apache.activemq.command.ConsumerInfo; //导入方法依赖的package包/类
public AdvisoryConsumer(ActiveMQConnection connection, ConsumerId consumerId) throws JMSException {
this.connection = connection;
info = new ConsumerInfo(consumerId);
info.setDestination(AdvisorySupport.TEMP_DESTINATION_COMPOSITE_ADVISORY_TOPIC);
info.setPrefetchSize(1000);
info.setNoLocal(true);
info.setDispatchAsync(true);
this.connection.addDispatcher(info.getConsumerId(), this);
this.connection.syncSendPacket(this.info);
}
示例5: createConsumerInfo
import org.apache.activemq.command.ConsumerInfo; //导入方法依赖的package包/类
protected ConsumerInfo createConsumerInfo(SessionInfo sessionInfo,
ActiveMQDestination destination) throws Exception {
ConsumerInfo info = new ConsumerInfo(sessionInfo, ++idGenerator);
info.setBrowser(false);
info.setDestination(destination);
info.setPrefetchSize(1000);
info.setDispatchAsync(false);
return info;
}
示例6: 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);
}
示例7: 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);
}
示例8: 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());
}
示例9: 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());
}