@Override public void run() { if (maxSlowDuration > 0) { // mark for (SlowConsumerEntry entry : slowConsumers.values()) { entry.mark(); } } HashMap<Subscription, SlowConsumerEntry> toAbort = new HashMap<Subscription, SlowConsumerEntry>(); for (Entry<Subscription, SlowConsumerEntry> entry : slowConsumers.entrySet()) { Subscription subscription = entry.getKey(); if (isIgnoreNetworkSubscriptions() && subscription.getConsumerInfo().isNetworkSubscription()) { if (slowConsumers.remove(subscription) != null) { LOG.info("network sub: {} is no longer slow", subscription.getConsumerInfo().getConsumerId()); } continue; } if (entry.getKey().isSlowConsumer()) { if (maxSlowDuration > 0 && (entry.getValue().markCount * checkPeriod >= maxSlowDuration) || maxSlowCount > 0 && entry.getValue().slowCount >= maxSlowCount) { toAbort.put(entry.getKey(), entry.getValue()); slowConsumers.remove(entry.getKey()); } } else { LOG.info("sub: " + entry.getKey().getConsumerInfo().getConsumerId() + " is no longer slow"); slowConsumers.remove(entry.getKey()); } } abortSubscription(toAbort, abortConnection); }
public Subscription addConsumer(ConnectionContext context, ConsumerInfo info) throws Exception { ActiveMQDestination dest = info.getDestination(); if (info.isNetworkSubscription()) { networkConsumerList.add(info); } else { if (id.equals(info.getConsumerId())) { nc.removeNetworkConsumerId(id); if (nc.isNetworkConsumersEmpty()) {
/** * 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()); } }
if (consumerInfo != null && consumerInfo.isNetworkSubscription() && isAdvisoryInterpretedByNetworkBridge(message)) { LOG.trace("not propagating advisory to network sub: " + consumerInfo.getConsumerId() + ", message: "+ message); hops = info.getBrokerPath() == null ? 0 : info.getBrokerPath().length; if (consumerTTL > -1 && hops >= consumerTTL) { if (LOG.isTraceEnabled()) { if (contains(info.getBrokerPath(), networkBrokerId)) { LOG.trace("ConsumerInfo advisory all ready routed once through target broker (" + networkBrokerId + "), path: "
private boolean canConduit(DemandSubscription ds) { return ds.isStaticallyIncluded() || ds.getRemoteInfo().getDestination().isTopic() || !ds.getRemoteInfo().isNetworkSubscription() || (ds.getRemoteInfo().getDestination().isQueue() && configuration.isConduitNetworkQueueSubscriptions()); }
private boolean hasNoLocalConsumers(final Message message, final MessageEvaluationContext mec) { Destination regionDestination = (Destination) mec.getMessageReference().getRegionDestination(); List<Subscription> consumers = regionDestination.getConsumers(); for (Subscription sub : consumers) { if (!sub.getConsumerInfo().isNetworkSubscription() && !sub.getConsumerInfo().isBrowser()) { if (!isSelectorAware()) { LOG.trace("Not replaying [{}] for [{}] to origin due to existing local consumer: {}", new Object[]{ message.getMessageId(), message.getDestination(), sub.getConsumerInfo() }); return false; } else { try { if (sub.matches(message, mec)) { LOG.trace("Not replaying [{}] for [{}] to origin due to existing selector matching local consumer: {}", new Object[]{ message.getMessageId(), message.getDestination(), sub.getConsumerInfo() }); return false; } } catch (Exception ignored) {} } } } return true; }
/** * 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()); } }
public Subscription addConsumer(ConnectionContext context, ConsumerInfo info) throws Exception { ActiveMQDestination dest = info.getDestination(); if (info.isNetworkSubscription()) { networkConsumerList.add(info); } else { if (id.equals(info.getConsumerId())) { nc.removeNetworkConsumerId(id); if (nc.isNetworkConsumersEmpty()) {
if (consumerInfo != null && consumerInfo.isNetworkSubscription() && isAdvisoryInterpretedByNetworkBridge(message)) { LOG.trace("not propagating advisory to network sub: " + consumerInfo.getConsumerId() + ", message: "+ message); hops = info.getBrokerPath() == null ? 0 : info.getBrokerPath().length; if (consumerTTL > -1 && hops >= consumerTTL) { if (LOG.isTraceEnabled()) { if (contains(info.getBrokerPath(), networkBrokerId)) { LOG.trace("ConsumerInfo advisory all ready routed once through target broker (" + networkBrokerId + "), path: "
private boolean canConduit(DemandSubscription ds) { return ds.isStaticallyIncluded() || ds.getRemoteInfo().getDestination().isTopic() || !ds.getRemoteInfo().isNetworkSubscription() || (ds.getRemoteInfo().getDestination().isQueue() && configuration.isConduitNetworkQueueSubscriptions()); }
private void updateSlowConsumersList(List<Subscription> subscribers) { for (Subscription subscriber : subscribers) { if (isIgnoreNetworkSubscriptions() && subscriber.getConsumerInfo().isNetworkSubscription()) { if (slowConsumers.remove(subscriber) != null) { LOG.info("network sub: {} is no longer slow", subscriber.getConsumerInfo().getConsumerId()); LOG.info("idle sub: {} is no longer slow", subscriber.getConsumerInfo().getConsumerId()); LOG.debug("sub: {} is now slow", subscriber.getConsumerInfo().getConsumerId()); SlowConsumerEntry entry = new SlowConsumerEntry(subscriber.getContext());
private boolean hasNoLocalConsumers(final Message message, final MessageEvaluationContext mec) { Destination regionDestination = (Destination) mec.getMessageReference().getRegionDestination(); List<Subscription> consumers = regionDestination.getConsumers(); for (Subscription sub : consumers) { if (!sub.getConsumerInfo().isNetworkSubscription() && !sub.getConsumerInfo().isBrowser()) { LOG.trace("Not replaying [{}] for [{}] to origin due to existing local consumer: {}", new Object[]{ message.getMessageId(), message.getDestination(), sub.getConsumerInfo() }); return false; } } return true; }
/** * 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()); } }
public Subscription addConsumer(ConnectionContext context, ConsumerInfo info) throws Exception { ActiveMQDestination dest = info.getDestination(); if (info.isNetworkSubscription()) { networkConsumerList.add(info); } else { if (id.equals(info.getConsumerId())) { nc.removeNetworkConsumerId(id); if (nc.isNetworkConsumersEmpty()) {
if (consumerInfo != null && consumerInfo.isNetworkSubscription() && isAdvisoryInterpretedByNetworkBridge(message)) { LOG.trace("not propagating advisory to network sub: " + consumerInfo.getConsumerId() + ", message: "+ message); hops = info.getBrokerPath() == null ? 0 : info.getBrokerPath().length; if (consumerTTL > -1 && hops >= consumerTTL) { if (LOG.isTraceEnabled()) { if (contains(info.getBrokerPath(), networkBrokerId)) { LOG.trace("ConsumerInfo advisory all ready routed once through target broker (" + networkBrokerId + "), path: "
private boolean canConduit(DemandSubscription ds) { return ds.isStaticallyIncluded() || ds.getRemoteInfo().getDestination().isTopic() || !ds.getRemoteInfo().isNetworkSubscription() || (ds.getRemoteInfo().getDestination().isQueue() && configuration.isConduitNetworkQueueSubscriptions()); }
@Override public void run() { if (maxSlowDuration > 0) { // mark for (SlowConsumerEntry entry : slowConsumers.values()) { entry.mark(); } } HashMap<Subscription, SlowConsumerEntry> toAbort = new HashMap<Subscription, SlowConsumerEntry>(); for (Entry<Subscription, SlowConsumerEntry> entry : slowConsumers.entrySet()) { Subscription subscription = entry.getKey(); if (isIgnoreNetworkSubscriptions() && subscription.getConsumerInfo().isNetworkSubscription()) { if (slowConsumers.remove(subscription) != null) { LOG.info("network sub: {} is no longer slow", subscription.getConsumerInfo().getConsumerId()); } continue; } if (entry.getKey().isSlowConsumer()) { if (maxSlowDuration > 0 && (entry.getValue().markCount * checkPeriod >= maxSlowDuration) || maxSlowCount > 0 && entry.getValue().slowCount >= maxSlowCount) { toAbort.put(entry.getKey(), entry.getValue()); slowConsumers.remove(entry.getKey()); } } else { LOG.info("sub: " + entry.getKey().getConsumerInfo().getConsumerId() + " is no longer slow"); slowConsumers.remove(entry.getKey()); } } abortSubscription(toAbort, abortConnection); }
private boolean hasNoLocalConsumers(final Message message, final MessageEvaluationContext mec) { Destination regionDestination = (Destination) mec.getMessageReference().getRegionDestination(); List<Subscription> consumers = regionDestination.getConsumers(); for (Subscription sub : consumers) { if (!sub.getConsumerInfo().isNetworkSubscription() && !sub.getConsumerInfo().isBrowser()) { LOG.trace("Not replaying [{}] for [{}] to origin due to existing local consumer: {}", new Object[]{ message.getMessageId(), message.getDestination(), sub.getConsumerInfo() }); return false; } } return true; }
/** * 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); } }
public Subscription addConsumer(ConnectionContext context, ConsumerInfo info) throws Exception { ActiveMQDestination dest = info.getDestination(); if (info.isNetworkSubscription()) { networkConsumerList.add(info); } else { if (id.equals(info.getConsumerId())) { nc.removeNetworkConsumerId(id); if (nc.isNetworkConsumersEmpty()) {