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); }
queueConsumerInfo.setDispatchAsync(dispatchAsync); queueConsumerInfo.setDestination(new ActiveMQQueue(destinationFilter)); queueConsumerInfo.setPrefetchSize(prefetchSize); queueConsumerInfo.setPriority(ConsumerInfo.NETWORK_CONSUMER_PRIORITY); localBroker.oneway(queueConsumerInfo); 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);
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());
private void restoreDurableQueue(List<ActiveMQQueue> queues) { try { for (ActiveMQQueue queue : queues) { String name = queue.getPhysicalName().substring(VIRTUALTOPIC_CONSUMER_PREFIX.length()); StringTokenizer tokenizer = new StringTokenizer(name); tokenizer.nextToken(":."); String qosString = tokenizer.nextToken(); tokenizer.nextToken(); String topicName = convertActiveMQToMQTT(tokenizer.nextToken("").substring(1)); QoS qoS = QoS.valueOf(qosString); LOG.trace("Restoring queue subscription: {}:{}", topicName, qoS); ConsumerInfo consumerInfo = new ConsumerInfo(getNextConsumerId()); consumerInfo.setDestination(queue); consumerInfo.setPrefetchSize(ActiveMQPrefetchPolicy.DEFAULT_QUEUE_PREFETCH); if (protocol.getActiveMQSubscriptionPrefetch() > 0) { consumerInfo.setPrefetchSize(protocol.getActiveMQSubscriptionPrefetch()); } consumerInfo.setRetroactive(true); consumerInfo.setDispatchAsync(true); doSubscribe(consumerInfo, topicName, qoS); // mark this durable subscription as restored by Broker restoredQueues.add(queue); } } catch (IOException e) { LOG.warn("Could not restore the MQTT queue subscriptions.", e); } }
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());
private byte onSubscribe(String topicName, QoS requestedQoS) throws MQTTProtocolException { ActiveMQDestination destination = new ActiveMQTopic(MQTTProtocolSupport.convertMQTTToActiveMQ(topicName)); ConsumerInfo consumerInfo = new ConsumerInfo(getNextConsumerId()); consumerInfo.setDestination(destination); consumerInfo.setPrefetchSize(ActiveMQPrefetchPolicy.DEFAULT_TOPIC_PREFETCH); consumerInfo.setRetroactive(true); consumerInfo.setDispatchAsync(true); // create durable subscriptions only when clean session is false if (!isCleanSession() && getClientId() != null && requestedQoS.ordinal() >= QoS.AT_LEAST_ONCE.ordinal()) { consumerInfo.setSubscriptionName(requestedQoS + ":" + topicName); consumerInfo.setPrefetchSize(ActiveMQPrefetchPolicy.DEFAULT_DURABLE_TOPIC_PREFETCH); } if (getActiveMQSubscriptionPrefetch() > 0) { consumerInfo.setPrefetchSize(getActiveMQSubscriptionPrefetch()); } return doSubscribe(consumerInfo, topicName, requestedQoS); }
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());
private byte onSubscribe(String topicName, QoS requestedQoS) throws MQTTProtocolException { ActiveMQDestination destination = new ActiveMQTopic(MQTTProtocolSupport.convertMQTTToActiveMQ(topicName)); ConsumerInfo consumerInfo = new ConsumerInfo(getNextConsumerId()); consumerInfo.setDestination(destination); consumerInfo.setPrefetchSize(ActiveMQPrefetchPolicy.DEFAULT_TOPIC_PREFETCH); consumerInfo.setRetroactive(true); consumerInfo.setDispatchAsync(true); // create durable subscriptions only when clean session is false if (!isCleanSession() && getClientId() != null && requestedQoS.ordinal() >= QoS.AT_LEAST_ONCE.ordinal()) { consumerInfo.setSubscriptionName(requestedQoS + ":" + topicName); consumerInfo.setPrefetchSize(ActiveMQPrefetchPolicy.DEFAULT_DURABLE_TOPIC_PREFETCH); } if (getActiveMQSubscriptionPrefetch() > 0) { consumerInfo.setPrefetchSize(getActiveMQSubscriptionPrefetch()); } return doSubscribe(consumerInfo, topicName, requestedQoS); }
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());
@Override public byte onSubscribe(String topicName, QoS requestedQoS) throws MQTTProtocolException { ActiveMQDestination destination = new ActiveMQTopic(MQTTProtocolSupport.convertMQTTToActiveMQ(topicName)); ConsumerInfo consumerInfo = new ConsumerInfo(getNextConsumerId()); consumerInfo.setDestination(destination); consumerInfo.setPrefetchSize(ActiveMQPrefetchPolicy.DEFAULT_TOPIC_PREFETCH); consumerInfo.setRetroactive(true); consumerInfo.setDispatchAsync(true); // create durable subscriptions only when clean session is false if (!protocol.isCleanSession() && protocol.getClientId() != null && requestedQoS.ordinal() >= QoS.AT_LEAST_ONCE.ordinal()) { consumerInfo.setSubscriptionName(requestedQoS + ":" + topicName); consumerInfo.setPrefetchSize(ActiveMQPrefetchPolicy.DEFAULT_DURABLE_TOPIC_PREFETCH); } if (protocol.getActiveMQSubscriptionPrefetch() > 0) { consumerInfo.setPrefetchSize(protocol.getActiveMQSubscriptionPrefetch()); } return doSubscribe(consumerInfo, topicName, requestedQoS); }
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());
@Override public byte onSubscribe(String topicName, QoS requestedQoS) throws MQTTProtocolException { ActiveMQDestination destination = new ActiveMQTopic(MQTTProtocolSupport.convertMQTTToActiveMQ(topicName)); ConsumerInfo consumerInfo = new ConsumerInfo(getNextConsumerId()); consumerInfo.setDestination(destination); consumerInfo.setPrefetchSize(ActiveMQPrefetchPolicy.DEFAULT_TOPIC_PREFETCH); consumerInfo.setRetroactive(true); consumerInfo.setDispatchAsync(true); // create durable subscriptions only when clean session is false if (!protocol.isCleanSession() && protocol.getClientId() != null && requestedQoS.ordinal() >= QoS.AT_LEAST_ONCE.ordinal()) { consumerInfo.setSubscriptionName(requestedQoS + ":" + topicName); consumerInfo.setPrefetchSize(ActiveMQPrefetchPolicy.DEFAULT_DURABLE_TOPIC_PREFETCH); } if (protocol.getActiveMQSubscriptionPrefetch() > 0) { consumerInfo.setPrefetchSize(protocol.getActiveMQSubscriptionPrefetch()); } return doSubscribe(consumerInfo, topicName, requestedQoS); }
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());
@Override public byte onSubscribe(String topicName, QoS requestedQoS) throws MQTTProtocolException { ActiveMQDestination destination = new ActiveMQTopic(MQTTProtocolSupport.convertMQTTToActiveMQ(topicName)); ConsumerInfo consumerInfo = new ConsumerInfo(getNextConsumerId()); consumerInfo.setDestination(destination); consumerInfo.setPrefetchSize(ActiveMQPrefetchPolicy.DEFAULT_TOPIC_PREFETCH); consumerInfo.setRetroactive(true); consumerInfo.setDispatchAsync(true); // create durable subscriptions only when clean session is false if (!protocol.isCleanSession() && protocol.getClientId() != null && requestedQoS.ordinal() >= QoS.AT_LEAST_ONCE.ordinal()) { consumerInfo.setSubscriptionName(requestedQoS + ":" + topicName); consumerInfo.setPrefetchSize(ActiveMQPrefetchPolicy.DEFAULT_DURABLE_TOPIC_PREFETCH); } if (protocol.getActiveMQSubscriptionPrefetch() > 0) { consumerInfo.setPrefetchSize(protocol.getActiveMQSubscriptionPrefetch()); } return doSubscribe(consumerInfo, topicName, requestedQoS); }
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.setClientId(looseUnmarshalString(dataIn)); info.setSubscriptionName(looseUnmarshalString(dataIn)); info.setNoLocal(dataIn.readBoolean()); info.setExclusive(dataIn.readBoolean()); info.setRetroactive(dataIn.readBoolean()); info.setPriority(dataIn.readByte());
destination = new ActiveMQTopic(converted); prefetch = ActiveMQPrefetchPolicy.DEFAULT_DURABLE_TOPIC_PREFETCH; consumerInfo.setSubscriptionName(requestedQoS + ":" + topicName); } else { converted = VIRTUALTOPIC_CONSUMER_PREFIX + consumerInfo.setDestination(destination); if (protocol.getActiveMQSubscriptionPrefetch() > 0) { consumerInfo.setPrefetchSize(protocol.getActiveMQSubscriptionPrefetch()); } else { consumerInfo.setPrefetchSize(prefetch); consumerInfo.setRetroactive(true); consumerInfo.setDispatchAsync(true);
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.setClientId(looseUnmarshalString(dataIn)); info.setSubscriptionName(looseUnmarshalString(dataIn)); info.setNoLocal(dataIn.readBoolean()); info.setExclusive(dataIn.readBoolean()); info.setRetroactive(dataIn.readBoolean()); info.setPriority(dataIn.readByte());
queueConsumerInfo.setDispatchAsync(dispatchAsync); queueConsumerInfo.setDestination(new ActiveMQQueue(destinationFilter)); queueConsumerInfo.setPrefetchSize(prefetchSize); queueConsumerInfo.setPriority(ConsumerInfo.NETWORK_CONSUMER_PRIORITY); localBroker.oneway(queueConsumerInfo); 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);
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.setClientId(looseUnmarshalString(dataIn)); info.setSubscriptionName(looseUnmarshalString(dataIn)); info.setNoLocal(dataIn.readBoolean()); info.setExclusive(dataIn.readBoolean()); info.setRetroactive(dataIn.readBoolean()); info.setPriority(dataIn.readByte());
queueConsumerInfo.setDispatchAsync(dispatchAsync); queueConsumerInfo.setDestination(new ActiveMQQueue(destinationFilter)); queueConsumerInfo.setPrefetchSize(prefetchSize); queueConsumerInfo.setPriority(ConsumerInfo.NETWORK_CONSUMER_PRIORITY); localBroker.oneway(queueConsumerInfo); 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);