@Override public CompositeData[] browse() throws OpenDataException { try { return browse(null); } catch (InvalidSelectorException e) { // should not happen. throw new RuntimeException(e); } }
@Override public TabularData browseAsTable() throws OpenDataException { try { return browseAsTable(null); } catch (InvalidSelectorException e) { throw new RuntimeException(e); } }
/** * Browses the current destination returning a list of messages */ @Override public List<Object> browseMessages() throws InvalidSelectorException { return browseMessages(null); }
@Override public boolean apply(DestinationView input) { boolean match = true; if (getName() != null && !getName().isEmpty()) { match = input.getName().contains(getName()); } if (match) { if (getFilter().equals("empty")) { match = input.getQueueSize() == 0; } if (getFilter().equals("nonEmpty")) { match = input.getQueueSize() != 0; } if (getFilter().equals("noConsumer")) { match = input.getConsumerCount() == 0; } if (getFilter().equals("nonAdvisory")) { return !(input instanceof TopicView && AdvisorySupport.isAdvisoryTopic(new ActiveMQTopic(input.getName()))); } } return match; } };
for (Map.Entry<ObjectName, DestinationView> entry : queueViews.entrySet()) { DestinationView queue = entry.getValue(); if (queue.getConsumerCount() == 0 && queue.getProducerCount() > 0) { ObjectName key = entry.getKey(); String message = "Queue " + queue.getName() + " has no consumers"; answer.add(new HealthStatus("org.apache.activemq.noConsumer", "WARNING", message, key.toString()));
@Override public String sendTextMessage(String body) throws Exception { return sendTextMessage(Collections.EMPTY_MAP, body); }
protected void unregisterDestination(ObjectName key) throws Exception { DestinationView view = removeAndRemember(topics, key, null); view = removeAndRemember(queues, key, view); view = removeAndRemember(temporaryQueues, key, view); view = removeAndRemember(temporaryTopics, key, view); if (registeredMBeans.remove(key)) { try { managementContext.unregisterMBean(key); } catch (Throwable e) { LOG.warn("Failed to unregister MBean {}", key); LOG.debug("Failure reason: ", e); } } if (view != null) { key = view.getSlowConsumerStrategy(); if (key!= null && registeredMBeans.remove(key)) { try { managementContext.unregisterMBean(key); } catch (Throwable e) { LOG.warn("Failed to unregister slow consumer strategy MBean {}", key); LOG.debug("Failure reason: ", e); } } } }
@Override public boolean apply(DestinationView input) { boolean match = true; if (getName() != null && !getName().isEmpty()) { match = input.getName().contains(getName()); } if (match) { if (getFilter().equals("empty")) { match = input.getQueueSize() == 0; } if (getFilter().equals("nonEmpty")) { match = input.getQueueSize() != 0; } if (getFilter().equals("noConsumer")) { match = input.getConsumerCount() == 0; } if (getFilter().equals("nonAdvisory")) { return !(input instanceof TopicView && AdvisorySupport.isAdvisoryTopic(new ActiveMQTopic(input.getName()))); } } return match; } };
for (Map.Entry<ObjectName, DestinationView> entry : queueViews.entrySet()) { DestinationView queue = entry.getValue(); if (queue.getConsumerCount() == 0 && queue.getProducerCount() > 0) { ObjectName key = entry.getKey(); String message = "Queue " + queue.getName() + " has no consumers"; answer.add(new HealthStatus("org.apache.activemq.noConsumer", "WARNING", message, key.toString()));
@Override public String sendTextMessage(Map headers, String body) throws Exception { return sendTextMessage(headers, body, null, null); }
protected void unregisterDestination(ObjectName key) throws Exception { DestinationView view = null; removeAndRemember(topics, key, view); removeAndRemember(queues, key, view); removeAndRemember(temporaryQueues, key, view); removeAndRemember(temporaryTopics, key, view); if (registeredMBeans.remove(key)) { try { managementContext.unregisterMBean(key); } catch (Throwable e) { LOG.warn("Failed to unregister MBean: " + key); LOG.debug("Failure reason: " + e, e); } } if (view != null) { key = view.getSlowConsumerStrategy(); if (key!= null && registeredMBeans.remove(key)) { try { managementContext.unregisterMBean(key); } catch (Throwable e) { LOG.warn("Failed to unregister slow consumer strategy MBean: " + key); LOG.debug("Failure reason: " + e, e); } } } }
@Override public boolean apply(DestinationView input) { boolean match = true; if (getName() != null && !getName().isEmpty()) { match = input.getName().contains(getName()); } if (match) { if (getFilter().equals("empty")) { match = input.getQueueSize() == 0; } if (getFilter().equals("nonEmpty")) { match = input.getQueueSize() != 0; } if (getFilter().equals("noConsumer")) { match = input.getConsumerCount() == 0; } if (getFilter().equals("nonAdvisory")) { return !(input instanceof TopicView && AdvisorySupport.isAdvisoryTopic(new ActiveMQTopic(input.getName()))); } } return match; } };
for (Map.Entry<ObjectName, DestinationView> entry : queueViews.entrySet()) { DestinationView queue = entry.getValue(); if (queue.getConsumerCount() == 0 && queue.getProducerCount() > 0) { ObjectName key = entry.getKey(); String message = "Queue " + queue.getName() + " has no consumers"; answer.add(new HealthStatus("org.apache.activemq.noConsumer", "WARNING", message, key.toString()));
@Override public String sendTextMessageWithProperties(String properties) throws Exception { String[] kvs = properties.split(","); Map<String, String> props = new HashMap<String, String>(); for (String kv : kvs) { String[] it = kv.split("="); if (it.length == 2) { props.put(it[0],it[1]); } } return sendTextMessage(props, props.remove("body"), props.remove("username"), props.remove("password")); }
public CompositeData[] browseQueue(String queueName) throws OpenDataException, MalformedObjectNameException { return safeGetBroker().getQueueView(queueName).browse(); }
/** * Browses the current destination returning a list of messages */ @Override public List<Object> browseMessages() throws InvalidSelectorException { return browseMessages(null); }
@Override public TabularData browseAsTable() throws OpenDataException { try { return browseAsTable(null); } catch (InvalidSelectorException e) { throw new RuntimeException(e); } }
protected void unregisterDestination(ObjectName key) throws Exception { DestinationView view = removeAndRemember(topics, key, null); view = removeAndRemember(queues, key, view); view = removeAndRemember(temporaryQueues, key, view); view = removeAndRemember(temporaryTopics, key, view); if (registeredMBeans.remove(key)) { try { managementContext.unregisterMBean(key); } catch (Throwable e) { LOG.warn("Failed to unregister MBean {}", key); LOG.debug("Failure reason: ", e); } } if (view != null) { key = view.getSlowConsumerStrategy(); if (key!= null && registeredMBeans.remove(key)) { try { managementContext.unregisterMBean(key); } catch (Throwable e) { LOG.warn("Failed to unregister slow consumer strategy MBean {}", key); LOG.debug("Failure reason: ", e); } } } }
@Override public boolean apply(DestinationView input) { boolean match = true; if (getName() != null && !getName().isEmpty()) { match = input.getName().contains(getName()); } if (match) { if (getFilter().equals("empty")) { match = input.getQueueSize() == 0; } if (getFilter().equals("nonEmpty")) { match = input.getQueueSize() != 0; } if (getFilter().equals("noConsumer")) { match = input.getConsumerCount() == 0; } if (getFilter().equals("nonAdvisory")) { return !(input instanceof TopicView && AdvisorySupport.isAdvisoryTopic(new ActiveMQTopic(input.getName()))); } } return match; } };
for (Map.Entry<ObjectName, DestinationView> entry : queueViews.entrySet()) { DestinationView queue = entry.getValue(); if (queue.getConsumerCount() == 0 && queue.getProducerCount() > 0) { ObjectName key = entry.getKey(); String message = "Queue " + queue.getName() + " has no consumers"; answer.add(new HealthStatus("org.apache.activemq.noConsumer", "WARNING", message, key.toString()));