private boolean hasDurableSubChanged(ConsumerInfo info1, ConsumerInfo info2) throws IOException { if (info1.getSelector() != null ^ info2.getSelector() != null) { return true; } if (info1.getSelector() != null && !info1.getSelector().equals(info2.getSelector())) { return true; } //Not all persistence adapters store the noLocal value for a subscription PersistenceAdapter adapter = broker.getBrokerService().getPersistenceAdapter(); if (adapter instanceof NoLocalSubscriptionAware) { if (info1.isNoLocal() ^ info2.isNoLocal()) { return true; } } return !info1.getDestination().equals(info2.getDestination()); }
/** * Write the booleans that this object uses to a BooleanStream */ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException { ConsumerInfo info = (ConsumerInfo)o; super.looseMarshal(wireFormat, o, dataOut); looseMarshalCachedObject(wireFormat, (DataStructure)info.getConsumerId(), dataOut); dataOut.writeBoolean(info.isBrowser()); looseMarshalCachedObject(wireFormat, (DataStructure)info.getDestination(), dataOut); dataOut.writeInt(info.getPrefetchSize()); dataOut.writeInt(info.getMaximumPendingMessageLimit()); dataOut.writeBoolean(info.isDispatchAsync()); looseMarshalString(info.getSelector(), dataOut); looseMarshalString(info.getSubscriptionName(), dataOut); dataOut.writeBoolean(info.isNoLocal()); dataOut.writeBoolean(info.isExclusive()); dataOut.writeBoolean(info.isRetroactive()); dataOut.writeByte(info.getPriority()); looseMarshalObjectArray(wireFormat, info.getBrokerPath(), dataOut); looseMarshalNestedObject(wireFormat, (DataStructure)info.getAdditionalPredicate(), dataOut); dataOut.writeBoolean(info.isNetworkSubscription()); dataOut.writeBoolean(info.isOptimizedAcknowledge()); dataOut.writeBoolean(info.isNoRangeAcks()); } }
private static BooleanExpression parseSelector(ConsumerInfo info) throws InvalidSelectorException { BooleanExpression rc = null; if (info.getSelector() != null) { rc = SelectorParser.parse(info.getSelector()); } if (info.isNoLocal()) { if (rc == null) { rc = new NoLocalExpression(info.getConsumerId().getConnectionId()); } else { rc = LogicExpression.createAND(new NoLocalExpression(info.getConsumerId().getConnectionId()), rc); } } if (info.getAdditionalPredicate() != null) { if (rc == null) { rc = info.getAdditionalPredicate(); } else { rc = LogicExpression.createAND(info.getAdditionalPredicate(), rc); } } return rc; }
throw new JMSException("Durable Consumers are not allowed"); ActiveMQDestination destination = info.getDestination(); if (!destination.isPattern()) { String subscriptionName = info.getSubscriptionName(); SubscriptionKey key = new SubscriptionKey(clientId, subscriptionName); DurableTopicSubscription sub = durableSubscriptions.get(key); } else { if (sub.getConsumerInfo().getConsumerId() != null) { subscriptions.remove(sub.getConsumerInfo().getConsumerId()); if (info.isNoLocal()) { sub.setSelector(sub.getSelector()); subscriptions.put(info.getConsumerId(), sub);
subscription.setSelector(subscription.getConsumerInfo().getSelector()); synchronized (consumers) { consumers.remove(subscription); info = new SubscriptionInfo(); info.setClientId(clientId); info.setSelector(subscription.getConsumerInfo().getSelector()); info.setSubscriptionName(subscriptionName); info.setDestination(getActiveMQDestination()); info.setNoLocal(subscription.getConsumerInfo().isNoLocal()); info.setSubscribedDestination(subscription.getConsumerInfo().getDestination()); topicStore.addSubscription(info, subscription.getConsumerInfo().isRetroactive());
public void init(SlowConsumerDetectionListener slowConsumerDetectionListener, long nativeId) throws Exception { SimpleString selector = info.getSelector() == null ? null : new SimpleString(SelectorTranslator.convertToActiveMQFilterString(info.getSelector())); boolean preAck = false; if (info.isNoLocal()) { if (!AdvisorySupport.isAdvisoryTopic(openwireDestination)) { selector = new SimpleString(noLocalSelector); } else { selector = new SimpleString(info.getSelector() + " AND " + noLocalSelector); SimpleString queueName = createTopicSubscription(info.isDurable(), info.getClientId(), destinationName.toString(), info.getSubscriptionName(), selector, destinationName); serverConsumer = session.getCoreSession().createConsumer(nativeId, queueName, null, info.getPriority(), info.isBrowser(), false, -1); serverConsumer.setlowConsumerDetection(slowConsumerDetectionListener); serverConsumer = session.getCoreSession().createConsumer(nativeId, destinationName, selector, info.getPriority(), info.isBrowser(), false, -1); serverConsumer.setlowConsumerDetection(slowConsumerDetectionListener); AddressSettings addrSettings = session.getCoreServer().getAddressSettingsRepository().getMatch(destinationName.toString()); cc.setConsumerId(info.getConsumerId()); cc.setPrefetch(0); session.getConnection().dispatch(cc);
final AmqpSender sender = new AmqpSender(this, protonSender, consumerInfo); LOG.debug("opening new sender {} on link: {}", consumerInfo.getConsumerId(), protonSender.getName()); destination = storedInfo.getDestination(); source.setDistributionMode(COPY); if (storedInfo.isNoLocal()) { supportedFilters.put(NO_LOCAL_NAME, AmqpNoLocalFilter.NO_LOCAL); if (storedInfo.getSelector() != null && !storedInfo.getSelector().trim().equals("")) { supportedFilters.put(JMS_SELECTOR_NAME, new AmqpJmsSelectorFilter(storedInfo.getSelector()));
/** * Write the booleans that this object uses to a BooleanStream */ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException { ConsumerInfo info = (ConsumerInfo)o; super.looseMarshal(wireFormat, o, dataOut); looseMarshalCachedObject(wireFormat, (DataStructure)info.getConsumerId(), dataOut); dataOut.writeBoolean(info.isBrowser()); looseMarshalCachedObject(wireFormat, (DataStructure)info.getDestination(), dataOut); dataOut.writeInt(info.getPrefetchSize()); dataOut.writeInt(info.getMaximumPendingMessageLimit()); dataOut.writeBoolean(info.isDispatchAsync()); looseMarshalString(info.getSelector(), dataOut); looseMarshalString(info.getSubscriptionName(), dataOut); dataOut.writeBoolean(info.isNoLocal()); dataOut.writeBoolean(info.isExclusive()); dataOut.writeBoolean(info.isRetroactive()); dataOut.writeByte(info.getPriority()); looseMarshalObjectArray(wireFormat, info.getBrokerPath(), dataOut); looseMarshalNestedObject(wireFormat, (DataStructure)info.getAdditionalPredicate(), dataOut); dataOut.writeBoolean(info.isNetworkSubscription()); dataOut.writeBoolean(info.isOptimizedAcknowledge()); dataOut.writeBoolean(info.isNoRangeAcks()); } }
throw new JMSException("Durable Consumers are not allowed"); ActiveMQDestination destination = info.getDestination(); if (!destination.isPattern()) { String subscriptionName = info.getSubscriptionName(); SubscriptionKey key = new SubscriptionKey(clientId, subscriptionName); DurableTopicSubscription sub = durableSubscriptions.get(key); } else { if (sub.getConsumerInfo().getConsumerId() != null) { subscriptions.remove(sub.getConsumerInfo().getConsumerId()); if (info.isNoLocal()) { sub.setSelector(sub.getSelector()); subscriptions.put(info.getConsumerId(), sub);
private static BooleanExpression parseSelector(ConsumerInfo info) throws InvalidSelectorException { BooleanExpression rc = null; if (info.getSelector() != null) { rc = SelectorParser.parse(info.getSelector()); } if (info.isNoLocal()) { if (rc == null) { rc = new NoLocalExpression(info.getConsumerId().getConnectionId()); } else { rc = LogicExpression.createAND(new NoLocalExpression(info.getConsumerId().getConnectionId()), rc); } } if (info.getAdditionalPredicate() != null) { if (rc == null) { rc = info.getAdditionalPredicate(); } else { rc = LogicExpression.createAND(info.getAdditionalPredicate(), rc); } } return rc; }
subscription.setSelector(subscription.getConsumerInfo().getSelector()); synchronized (consumers) { consumers.remove(subscription); info = new SubscriptionInfo(); info.setClientId(clientId); info.setSelector(subscription.getConsumerInfo().getSelector()); info.setSubscriptionName(subscriptionName); info.setDestination(getActiveMQDestination()); info.setNoLocal(subscription.getConsumerInfo().isNoLocal()); info.setSubscribedDestination(subscription.getConsumerInfo().getDestination()); topicStore.addSubscription(info, subscription.getConsumerInfo().isRetroactive());
final AmqpSender sender = new AmqpSender(this, protonSender, consumerInfo); LOG.debug("opening new sender {} on link: {}", consumerInfo.getConsumerId(), protonSender.getName()); destination = storedInfo.getDestination(); source.setDistributionMode(COPY); if (storedInfo.isNoLocal()) { supportedFilters.put(NO_LOCAL_NAME, AmqpNoLocalFilter.NO_LOCAL); if (storedInfo.getSelector() != null && !storedInfo.getSelector().trim().equals("")) { supportedFilters.put(JMS_SELECTOR_NAME, new AmqpJmsSelectorFilter(storedInfo.getSelector()));
private boolean hasDurableSubChanged(ConsumerInfo info1, ConsumerInfo info2) throws IOException { if (info1.getSelector() != null ^ info2.getSelector() != null) { return true; } if (info1.getSelector() != null && !info1.getSelector().equals(info2.getSelector())) { return true; } //Not all persistence adapters store the noLocal value for a subscription PersistenceAdapter adapter = broker.getBrokerService().getPersistenceAdapter(); if (adapter instanceof NoLocalSubscriptionAware) { if (info1.isNoLocal() ^ info2.isNoLocal()) { return true; } } return !info1.getDestination().equals(info2.getDestination()); }
/** * Write the booleans that this object uses to a BooleanStream */ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException { ConsumerInfo info = (ConsumerInfo)o; super.looseMarshal(wireFormat, o, dataOut); looseMarshalCachedObject(wireFormat, (DataStructure)info.getConsumerId(), dataOut); dataOut.writeBoolean(info.isBrowser()); looseMarshalCachedObject(wireFormat, (DataStructure)info.getDestination(), dataOut); dataOut.writeInt(info.getPrefetchSize()); dataOut.writeInt(info.getMaximumPendingMessageLimit()); dataOut.writeBoolean(info.isDispatchAsync()); looseMarshalString(info.getSelector(), dataOut); looseMarshalString(info.getSubscriptionName(), dataOut); dataOut.writeBoolean(info.isNoLocal()); dataOut.writeBoolean(info.isExclusive()); dataOut.writeBoolean(info.isRetroactive()); dataOut.writeByte(info.getPriority()); looseMarshalObjectArray(wireFormat, info.getBrokerPath(), dataOut); looseMarshalNestedObject(wireFormat, (DataStructure)info.getAdditionalPredicate(), dataOut); dataOut.writeBoolean(info.isNetworkSubscription()); dataOut.writeBoolean(info.isOptimizedAcknowledge()); dataOut.writeBoolean(info.isNoRangeAcks()); } }
throw new JMSException("Durable Consumers are not allowed"); ActiveMQDestination destination = info.getDestination(); if (!destination.isPattern()) { String subscriptionName = info.getSubscriptionName(); SubscriptionKey key = new SubscriptionKey(clientId, subscriptionName); DurableTopicSubscription sub = durableSubscriptions.get(key); } else { if (sub.getConsumerInfo().getConsumerId() != null) { subscriptions.remove(sub.getConsumerInfo().getConsumerId()); if (info.isNoLocal()) { sub.setSelector(sub.getSelector()); subscriptions.put(info.getConsumerId(), sub);
private static BooleanExpression parseSelector(ConsumerInfo info) throws InvalidSelectorException { BooleanExpression rc = null; if (info.getSelector() != null) { rc = SelectorParser.parse(info.getSelector()); } if (info.isNoLocal()) { if (rc == null) { rc = new NoLocalExpression(info.getConsumerId().getConnectionId()); } else { rc = LogicExpression.createAND(new NoLocalExpression(info.getConsumerId().getConnectionId()), rc); } } if (info.getAdditionalPredicate() != null) { if (rc == null) { rc = info.getAdditionalPredicate(); } else { rc = LogicExpression.createAND(info.getAdditionalPredicate(), rc); } } return rc; }
subscription.setSelector(subscription.getConsumerInfo().getSelector()); synchronized (consumers) { consumers.remove(subscription); info = new SubscriptionInfo(); info.setClientId(clientId); info.setSelector(subscription.getConsumerInfo().getSelector()); info.setSubscriptionName(subscriptionName); info.setDestination(getActiveMQDestination()); info.setNoLocal(subscription.getConsumerInfo().isNoLocal()); info.setSubscribedDestination(subscription.getConsumerInfo().getDestination()); topicStore.addSubscription(info, subscription.getConsumerInfo().isRetroactive());
private boolean hasDurableSubChanged(ConsumerInfo info1, ConsumerInfo info2) throws IOException { if (info1.getSelector() != null ^ info2.getSelector() != null) { return true; } if (info1.getSelector() != null && !info1.getSelector().equals(info2.getSelector())) { return true; } //Not all persistence adapters store the noLocal value for a subscription PersistenceAdapter adapter = broker.getBrokerService().getPersistenceAdapter(); if (adapter instanceof NoLocalSubscriptionAware) { if (info1.isNoLocal() ^ info2.isNoLocal()) { return true; } } return !info1.getDestination().equals(info2.getDestination()); }
/** * Write the booleans that this object uses to a BooleanStream */ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException { ConsumerInfo info = (ConsumerInfo)o; super.looseMarshal(wireFormat, o, dataOut); looseMarshalCachedObject(wireFormat, (DataStructure)info.getConsumerId(), dataOut); dataOut.writeBoolean(info.isBrowser()); looseMarshalCachedObject(wireFormat, (DataStructure)info.getDestination(), dataOut); dataOut.writeInt(info.getPrefetchSize()); dataOut.writeInt(info.getMaximumPendingMessageLimit()); dataOut.writeBoolean(info.isDispatchAsync()); looseMarshalString(info.getSelector(), dataOut); looseMarshalString(info.getSubscriptionName(), dataOut); dataOut.writeBoolean(info.isNoLocal()); dataOut.writeBoolean(info.isExclusive()); dataOut.writeBoolean(info.isRetroactive()); dataOut.writeByte(info.getPriority()); looseMarshalObjectArray(wireFormat, info.getBrokerPath(), dataOut); looseMarshalNestedObject(wireFormat, (DataStructure)info.getAdditionalPredicate(), dataOut); dataOut.writeBoolean(info.isNetworkSubscription()); dataOut.writeBoolean(info.isOptimizedAcknowledge()); dataOut.writeBoolean(info.isNoRangeAcks()); looseMarshalObjectArray(wireFormat, info.getNetworkConsumerPath(), dataOut); } }
throw new JMSException("Durable Consumers are not allowed"); ActiveMQDestination destination = info.getDestination(); if (!destination.isPattern()) { String subscriptionName = info.getSubscriptionName(); SubscriptionKey key = new SubscriptionKey(clientId, subscriptionName); DurableTopicSubscription sub = durableSubscriptions.get(key); } else { if (sub.getConsumerInfo().getConsumerId() != null) { subscriptions.remove(sub.getConsumerInfo().getConsumerId()); if (info.isNoLocal()) { sub.setSelector(sub.getSelector()); subscriptions.put(info.getConsumerId(), sub);