Bootstrap

Java远程监控ActiveMQ消息队列

因为公司的产品架构有用到ActiveMQ消息队列,在之前的压力测试上有发现ActiveMQ存在消费不过来的情况,这里记录下在Linux系统下如何实现通过Java对ActiveMQ消息队列的监控。
在这里插入图片描述
Java是通过配置JMX来监控ActiveMQ的消息队列的,这里用到消息队列工具类,放下实现类:

import java.io.IOException;
import java.util.PriorityQueue;

import javax.management.MBeanServerConnection;
import javax.management.MBeanServerInvocationHandler;
import javax.management.MalformedObjectNameException;
import javax.management.ObjectName;
import javax.management.remote.JMXConnector;
import javax.management.remote.JMXConnectorFactory;
import javax.management.remote.JMXServiceURL;

import org.apache.activemq.broker.jmx.BrokerViewMBean;
import org.apache.activemq.broker.jmx.QueueViewMBean;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import cn.itcast.ssm.po.MQQue;

public class ActiveMqKit {

	 
	 	public static final String reportQueueName ="zc-queue-actual";//生成核对报告队列名
	    private static Log log = LogFactory.getLog(ActiveMqKit.class);
	    private static final String connectorPort = "11099";
	    private static final String connectorPath = "/jmxrmi";
	    private static final String jmxDomain = "org.apache.activemq";


	    public static PriorityQueue<MQQue> getAllQueue(String ip)throws Exception {
	        
	        Bro
;