protected List<Subscription> addSubscriptionsForDestination(ConnectionContext context, Destination dest) throws Exception { List<Subscription> rc = new ArrayList<Subscription>(); // Add all consumers that are interested in the destination. for (Iterator<Subscription> iter = subscriptions.values().iterator(); iter.hasNext();) { Subscription sub = iter.next(); if (sub.matches(dest.getActiveMQDestination())) { try { ConnectionContext originalContext = sub.getContext() != null ? sub.getContext() : context; dest.addSubscription(originalContext, sub); rc.add(sub); } catch (SecurityException e) { if (sub.isWildcard()) { LOG.debug("Subscription denied for " + sub + " to destination " + dest.getActiveMQDestination() + ": " + e.getMessage()); } else { throw e; } } } } return rc; }
public void unregisterSubscription(Subscription sub) { ObjectName name = subscriptionMap.remove(sub); if (name != null) { try { SubscriptionKey subscriptionKey = new SubscriptionKey(sub.getContext().getClientId(), sub.getConsumerInfo().getSubscriptionName()); ObjectName inactiveName = subscriptionKeys.remove(subscriptionKey); if (inactiveName != null) { inactiveDurableTopicSubscribers.remove(inactiveName); managementContext.unregisterMBean(inactiveName); } } catch (Exception e) { LOG.error("Failed to unregister subscription {}", sub, e); } } }
@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 Subscription addConsumer(ConnectionContext context, ConsumerInfo info) throws Exception { Subscription sub = super.addConsumer(context, info); SubscriptionKey subscriptionKey = new SubscriptionKey(sub.getContext().getClientId(), sub.getConsumerInfo().getSubscriptionName()); ObjectName inactiveName = subscriptionKeys.get(subscriptionKey); if (inactiveName != null) { // if it was inactive, register it registerSubscription(context, sub); } return sub; }
/** * @returns the ObjectName of the Connection that created this subscription */ @Override public ObjectName getConnection() { ObjectName result = null; if (clientId != null && subscription != null) { ConnectionContext ctx = subscription.getContext(); if (ctx != null && ctx.getBroker() != null && ctx.getBroker().getBrokerService() != null) { BrokerService service = ctx.getBroker().getBrokerService(); ManagementContext managementCtx = service.getManagementContext(); if (managementCtx != null) { try { ObjectName query = createConnectionQuery(managementCtx, service.getBrokerName()); Set<ObjectName> names = managementCtx.queryNames(query, null); if (names.size() == 1) { result = names.iterator().next(); } } catch (Exception e) { } } } } return result; }
if (!slowConsumers.containsKey(subscriber)) { LOG.debug("sub: {} is now slow", subscriber.getConsumerInfo().getConsumerId()); SlowConsumerEntry entry = new SlowConsumerEntry(subscriber.getContext());
for (Subscription subscription : topicRegion.getDurableSubscriptions().values()) { String subName = subscription.getConsumerInfo().getSubscriptionName(); String clientId = subscription.getContext().getClientId(); if (subName != null && subName.equals(candidateSubName) && clientId.startsWith(configuration.getName())) { DemandSubscription sub = createDemandSubscription(dest, subName);
public void unregisterSubscription(Subscription sub) { ObjectName name = subscriptionMap.remove(sub); if (name != null) { try { SubscriptionKey subscriptionKey = new SubscriptionKey(sub.getContext().getClientId(), sub.getConsumerInfo().getSubscriptionName()); ObjectName inactiveName = subscriptionKeys.remove(subscriptionKey); if (inactiveName != null) { inactiveDurableTopicSubscribers.remove(inactiveName); managementContext.unregisterMBean(inactiveName); } } catch (Exception e) { LOG.error("Failed to unregister subscription {}", sub, e); } } }
public void unregisterSubscription(Subscription sub) { ObjectName name = subscriptionMap.remove(sub); if (name != null) { try { SubscriptionKey subscriptionKey = new SubscriptionKey(sub.getContext().getClientId(), sub.getConsumerInfo().getSubscriptionName()); ObjectName inactiveName = subscriptionKeys.remove(subscriptionKey); if (inactiveName != null) { inactiveDurableTopicSubscribers.remove(inactiveName); managementContext.unregisterMBean(inactiveName); } } catch (Exception e) { LOG.error("Failed to unregister subscription {}", sub, e); } } }
public void unregisterSubscription(Subscription sub) { ObjectName name = subscriptionMap.remove(sub); if (name != null) { try { SubscriptionKey subscriptionKey = new SubscriptionKey(sub.getContext().getClientId(), sub.getConsumerInfo().getSubscriptionName()); ObjectName inactiveName = subscriptionKeys.get(subscriptionKey); if (inactiveName != null) { inactiveDurableTopicSubscribers.remove(inactiveName); managementContext.unregisterMBean(inactiveName); } } catch (Exception e) { LOG.error("Failed to unregister subscription " + sub, e); } } }
public void unregisterSubscription(Subscription sub) { ObjectName name = subscriptionMap.remove(sub); if (name != null) { try { SubscriptionKey subscriptionKey = new SubscriptionKey(sub.getContext().getClientId(), sub.getConsumerInfo().getSubscriptionName()); ObjectName inactiveName = subscriptionKeys.remove(subscriptionKey); if (inactiveName != null) { inactiveDurableTopicSubscribers.remove(inactiveName); managementContext.unregisterMBean(inactiveName); } } catch (Exception e) { LOG.error("Failed to unregister subscription {}", sub, e); } } }
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 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 Subscription addConsumer(ConnectionContext context, ConsumerInfo info) throws Exception { Subscription sub = super.addConsumer(context, info); SubscriptionKey subscriptionKey = new SubscriptionKey(sub.getContext().getClientId(), sub.getConsumerInfo().getSubscriptionName()); ObjectName inactiveName = subscriptionKeys.get(subscriptionKey); if (inactiveName != null) { // if it was inactive, register it registerSubscription(context, sub); } return sub; }
@Override public Subscription addConsumer(ConnectionContext context, ConsumerInfo info) throws Exception { Subscription sub = super.addConsumer(context, info); SubscriptionKey subscriptionKey = new SubscriptionKey(sub.getContext().getClientId(), sub.getConsumerInfo().getSubscriptionName()); ObjectName inactiveName = subscriptionKeys.get(subscriptionKey); if (inactiveName != null) { // if it was inactive, register it registerSubscription(context, sub); } return sub; }
@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 Subscription addConsumer(ConnectionContext context, ConsumerInfo info) throws Exception { Subscription sub = super.addConsumer(context, info); SubscriptionKey subscriptionKey = new SubscriptionKey(sub.getContext().getClientId(), sub.getConsumerInfo().getSubscriptionName()); ObjectName inactiveName = subscriptionKeys.get(subscriptionKey); if (inactiveName != null) { // if it was inactive, register it registerSubscription(context, sub); } return sub; }
@Override public Subscription addConsumer(ConnectionContext context, ConsumerInfo info) throws Exception { Subscription sub = super.addConsumer(context, info); SubscriptionKey subscriptionKey = new SubscriptionKey(sub.getContext().getClientId(), sub.getConsumerInfo().getSubscriptionName()); ObjectName inactiveName = subscriptionKeys.get(subscriptionKey); if (inactiveName != null) { // if it was inactive, register it registerSubscription(context, sub); } return sub; }
private void deleteDestination (Broker broker, ActiveMQDestination amqDestination, Destination destination) throws Exception { List<Subscription> subscriptions = destination.getConsumers(); for (Subscription subscription: subscriptions) { ConsumerInfo info = new ConsumerInfo(); info.setDestination(amqDestination); info.setConsumerId(subscription.getConsumerInfo().getConsumerId()); broker.removeConsumer(subscription.getContext(), info); } ConnectionContext context = new ConnectionContext(); context.setBroker(broker); broker.removeDestination(context, amqDestination, 0); log.info("processQueues - successfully remove queue " + destination.getName()); } }