@Override public List<Subscription> getConsumers() { return next.getConsumers(); }
List<Subscription> subscribers = destination.getConsumers();
@Override public synchronized void removeAll(){ cache.clear(); if (destination != null) { for (Subscription s : destination.getConsumers()) { s.getConsumerInfo().clearAssignedGroupCount(destination.getActiveMQDestination()); } } }
@Override public ObjectName[] getSubscriptions() throws IOException, MalformedObjectNameException { List<Subscription> subscriptions = destination.getConsumers(); ObjectName[] answer = new ObjectName[subscriptions.size()]; ObjectName brokerObjectName = broker.getBrokerService().getBrokerObjectName(); int index = 0; for (Subscription subscription : subscriptions) { String connectionClientId = subscription.getContext().getClientId(); answer[index++] = BrokerMBeanSupport.createSubscriptionName(brokerObjectName, connectionClientId, subscription.getConsumerInfo()); } return answer; }
@Override public boolean removeEldestEntry(final Map.Entry eldest) { boolean remove = super.removeEldestEntry(eldest); if (remove) { if (destination != null) { for (Subscription s : destination.getConsumers()) { if (s.getConsumerInfo().getConsumerId().equals(eldest.getValue())) { s.getConsumerInfo().decrementAssignedGroupCount(destination.getActiveMQDestination()); break; } } } } return remove; } };
public void removeQueue(String queueName) { try { ActiveMQQueue destination = new ActiveMQQueue(queueName); ConnectionContext connectionContext = BrokerSupport.getConnectionContext(broker.getBroker()); Destination brokerDestination = broker.getDestination(destination); List<Subscription> consumers = brokerDestination.getConsumers(); for (Subscription consumer : consumers) { consumer.remove(connectionContext, brokerDestination); brokerDestination.removeSubscription(connectionContext, consumer, 0); } broker.getBroker().removeDestination(connectionContext, destination, 1000); broker.removeDestination(destination); } catch (Exception e) { throw bomb(e); } }
/** * Respect the selectors of the subscriptions to ensure only matched messages are dispatched to * the virtual queues, hence there is no build up of unmatched messages on these destinations */ @Override protected boolean shouldDispatch(final Broker broker, Message message, Destination dest) throws IOException { //first validate that the prefix matches in the super class if (super.shouldDispatch(broker, message, dest)) { boolean matches = false; MessageEvaluationContext msgContext = new NonCachedMessageEvaluationContext(); msgContext.setDestination(dest.getActiveMQDestination()); msgContext.setMessageReference(message); List<Subscription> subs = dest.getConsumers(); for (Subscription sub : subs) { if (sub.matches(message, msgContext)) { matches = true; break; } } if (matches == false) { matches = tryMatchingCachedSubs(broker, dest, msgContext); } return matches; } return false; }
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; }
@Override public List<Subscription> getConsumers() { return next.getConsumers(); }
@Override public List<Subscription> getConsumers() { return next.getConsumers(); }
@Override public List<Subscription> getConsumers() { return next.getConsumers(); }
public ObjectName[] getSubscriptions() throws IOException, MalformedObjectNameException { List<Subscription> subscriptions = destination.getConsumers(); ObjectName[] answer = new ObjectName[subscriptions.size()]; ObjectName objectName = broker.getBrokerService().getBrokerObjectName(); int index = 0; for (Subscription subscription : subscriptions) { String connectionClientId = subscription.getContext().getClientId(); String objectNameStr = ManagedRegionBroker.getSubscriptionObjectName(subscription, connectionClientId, objectName); answer[index++] = new ObjectName(objectNameStr); } return answer; }
@Override public synchronized void removeAll(){ cache.clear(); if (destination != null) { for (Subscription s : destination.getConsumers()) { s.getConsumerInfo().clearAssignedGroupCount(destination.getActiveMQDestination()); } } }
@Override public synchronized void removeAll(){ cache.clear(); if (destination != null) { for (Subscription s : destination.getConsumers()) { s.getConsumerInfo().clearAssignedGroupCount(destination.getActiveMQDestination()); } } }
@Override public synchronized void removeAll(){ cache.clear(); if (destination != null) { for (Subscription s : destination.getConsumers()) { s.getConsumerInfo().clearAssignedGroupCount(destination.getActiveMQDestination()); } } }
@Override public ObjectName[] getSubscriptions() throws IOException, MalformedObjectNameException { List<Subscription> subscriptions = destination.getConsumers(); ObjectName[] answer = new ObjectName[subscriptions.size()]; ObjectName brokerObjectName = broker.getBrokerService().getBrokerObjectName(); int index = 0; for (Subscription subscription : subscriptions) { String connectionClientId = subscription.getContext().getClientId(); answer[index++] = BrokerMBeanSupport.createSubscriptionName(brokerObjectName, connectionClientId, subscription.getConsumerInfo()); } return answer; }
@Override public ObjectName[] getSubscriptions() throws IOException, MalformedObjectNameException { List<Subscription> subscriptions = destination.getConsumers(); ObjectName[] answer = new ObjectName[subscriptions.size()]; ObjectName brokerObjectName = broker.getBrokerService().getBrokerObjectName(); int index = 0; for (Subscription subscription : subscriptions) { String connectionClientId = subscription.getContext().getClientId(); answer[index++] = BrokerMBeanSupport.createSubscriptionName(brokerObjectName, connectionClientId, subscription.getConsumerInfo()); } return answer; }
@Override public ObjectName[] getSubscriptions() throws IOException, MalformedObjectNameException { List<Subscription> subscriptions = destination.getConsumers(); ObjectName[] answer = new ObjectName[subscriptions.size()]; ObjectName brokerObjectName = broker.getBrokerService().getBrokerObjectName(); int index = 0; for (Subscription subscription : subscriptions) { String connectionClientId = subscription.getContext().getClientId(); answer[index++] = BrokerMBeanSupport.createSubscriptionName(brokerObjectName, connectionClientId, subscription.getConsumerInfo()); } return answer; }
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; }
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; }