打开JMX

<broker … useJmx="true">

  <managementContext>

<managementContext createConnector="true"/>

</managementContext>

</broker>

启动ActiveMQ

$ activemq start

启动 JMX console

$ jconsole

选择远程进程,输入url:

service:jmx:rmi:///jndi/rmi://localhost:1099/jmxrmi

访问ActiveMQ Jolokia REST API

read Reading of MBean attributes
write Setting of MBean attributes
exec Execution of JMX operations
list List the available MBeans along with their supported attributes and operations.
search Searching for MBeans
version Getting version and server information

每种命令的url格式。

<base-url>/read/<mbean name>/<attribute name>/<inner path>

<base url>/write/<mbean name>/<attribute name>/<value>/<inner path>

<base url>/exec/<mbean name>/<operation name>/<arg1>/<arg2>/....

<base-url>/search/<pattern>

<base-url>/list/<inner path>

<base-url>/version

例子:

拿到broker的属性值

http://localhost:8161/api/jolokia/read/org.apache.activemq:brokerName=localhost,type=Broker

{

"timestamp": 1463105087,

"status": 200,

"request": {

"mbean": "org.apache.activemq:brokerName=localhost,type=Broker",

"type": "read"

},

"value": {

"BrokerId": "ID:NOTE140082-51092-1463022383093-0:1",

"TemporaryQueues": [],

"StompSslURL": "",

"TemporaryTopicProducers": [],

"StoreLimit": 107374182400,

"TotalConsumerCount": 0,

"DurableTopicSubscribers": [],

"Slave": false,

"StompURL": "stomp:\/\/NOTE140082:61613?maximumConnections=1000&wireFormat.maxFrameSize=104857600",

"TopicSubscribers": [],

"QueueProducers": [],

"VMURL": "vm:\/\/localhost",

"Uptime": "22 hours 58 minutes",

"TotalMessageCount": 0,

"Topics": [

{

"objectName": "org.apache.activemq:brokerName=localhost,destinationName=ActiveMQ.Advisory.MasterBroker,destinationType=Topic,type=Broker"

},

{

"objectName": "org.apache.activemq:brokerName=localhost,destinationName=ActiveMQ.Advisory.Queue,destinationType=Topic,type=Broker"

}

],

"TopicProducers": [],

"BrokerName": "localhost",

"OpenWireURL": "tcp:\/\/NOTE140082:61616?maximumConnections=1000&wireFormat.maxFrameSize=104857600",

"MinMessageSize": 1024,

"QueueSubscribers": [],

"TotalDequeueCount": 0,

"TemporaryTopics": [],

"BrokerVersion": "5.13.2",

"AverageMessageSize": 1024,

"StorePercentUsage": 0,

"TemporaryQueueProducers": [],

"TotalEnqueueCount": 3,

"Persistent": true,

"TransportConnectors": {

"amqp": "amqp:\/\/NOTE140082:5672?maximumConnections=1000&wireFormat.maxFrameSize=104857600",

"mqtt": "mqtt:\/\/NOTE140082:1883?maximumConnections=1000&wireFormat.maxFrameSize=104857600",

"openwire": "tcp:\/\/NOTE140082:61616?maximumConnections=1000&wireFormat.maxFrameSize=104857600",

"ws": "ws:\/\/NOTE140082:61614?maximumConnections=1000&wireFormat.maxFrameSize=104857600",

"stomp": "stomp:\/\/NOTE140082:61613?maximumConnections=1000&wireFormat.maxFrameSize=104857600"

},

"InactiveDurableTopicSubscribers": [],

"TemporaryTopicSubscribers": [],

"TemporaryQueueSubscribers": [],

"DynamicDestinationProducers": [],

"MemoryPercentUsage": 0,

"MemoryLimit": 726571418,

"Queues": [

{

"objectName": "org.apache.activemq:brokerName=localhost,destinationName=1111,destinationType=Queue,type=Broker"

},

{

"objectName": "org.apache.activemq:brokerName=localhost,destinationName=22222,destinationType=Queue,type=Broker"

}

],

"TotalConnectionsCount": 0,

"UptimeMillis": 82705502,

"DataDirectory": "E:\\apache-activemq-5.13.2\\data",

"TempLimit": 53687091200,

"JobSchedulerStoreLimit": 0,

"JobSchedulerStorePercentUsage": 0,

"SslURL": "",

"StatisticsEnabled": true,

"CurrentConnectionsCount": 0,

"JMSJobScheduler": null,

"TotalProducerCount": 0,

"MaxMessageSize": 1024,

"TempPercentUsage": 0

}

}

获取单个属性的值

http://localhost:8161/api/jolokia/read/org.apache.activemq:brokerName=localhost,type=Broker/BrokerId

http://localhost:8161/api/jolokia/read/org.apache.activemq:brokerName=localhost,type=Broker/ StompURL

搜索broker。

http://localhost:8161/api/jolokia/search/*:type=Broker,brokerName=*

这里可以用在初始获取broker信息的时候使用。因为如果activemq如果配置了jmxDomainName,<mbean name>就要写成:<jmxDomainName>:type,brokerName=。如果不配置默认是:org.apache.activemq。

<managementContext>

<managementContext createConnector="true" jmxDomainName="test.domain"/>

</managementContext>

http://localhost:8161/api/jolokia/read/test.domain:brokerName=localhost,type=Broker/BrokerId

这个能搜索所有的队列,包括队列的属性。但是如果当前没有队列,会返回错误。

http://localhost:8161/api/jolokia/read/org.apache.activemq:brokerName=localhost,type=Broker,destinationType=Queue,destinationName=*

通过broker的属性queues,只能拿到队列的名称列表,拿不到具体的队列属性。

http://localhost:8161/api/jolokia/read/test.domain:brokerName=localhost,type=Broker/Queues

jolokia官方在线文档:

https://jolokia.org/reference/html/index.html

jolokia官方pdf文档:

https://jolokia.org/reference/pdf/jolokia-reference.pdf

Activemq Jolokia的更多相关文章

  1. ActiveMQ点对点的消息发送案例

    公司最近会用MQ对某些业务进行处理,所以,这次我下载了apache-activemq-5.12.0-bin把玩下. 基于练习方便需要,使用Windows的版本. 参考的优秀文章: activemq的几 ...

  2. activemq.bat 在window7 x64下启动(安装)报错解决方案

    在启动  apache-activemq-5.15.2/activemq.bat  时候报错,提示以下信息: wrapper | --> Wrapper Started as Consolewr ...

  3. 【ActiveMQ】ActiveMQ在Windows的安装,以及点对点的消息发送案例

    公司最近会用MQ对某些业务进行处理,所以,这次我下载了apache-activemq-5.12.0-bin把玩下. 基于练习方便需要,使用Windows的版本. 参考的优秀文章: activemq的几 ...

  4. Windows下安装ActiveMQ

    到官网(http://activemq.apache.org/download-archives.html)下载最新发布的压缩包(我下的是5.15.9)到本地后解压(我解压到D盘Dev目录下)即可.进 ...

  5. activeMQ---->ActiveMQ的使用(一)

    这里通过一个入门的案例来体会一下ActiveMQ的作用以及使用方法.你要做一个不动声色的大人了.不准情绪化,不准偷偷想念,不准回头看.去过自己另外的生活.你要听话,不是所有的鱼都会生活在同一片海里. ...

  6. 使用jolokia api监控ActiveMQ

    jolokia api提供了一种通过HTTP访问JMX获得AMQ后台数据的一种方式,即Restful Api #!/usr/bin/env python # -*- coding:utf-8 -*- ...

  7. Apache ActiveMQの版本更迭和Apache ActiveMQの故障转移

    本文描述apache activemq 版本更迭的原因以及Apache ActiveMQのThe Failover Transport new features in 5.2.0  1.对信息的传输/ ...

  8. SharedFile System Master Slave(共享文件系统)做ActiveMQ集群

    WINDOWS环境下:http://www.apache.org/dyn/closer.cgi?path=/activemq/apache-activemq/5.9.0/apache-activemq ...

  9. ActiveMQ笔记:管理和监控

    ActiveMQ提供了比较丰富的监控和管理工具.在ActiveMQ的网页里(http://activemq.apache.org/how-can-i-monitor-activemq.html)提到了 ...

随机推荐

  1. 讲讲Android事件拦截机制

    简介 什么是触摸事件?顾名思义,触摸事件就是捕获触摸屏幕后产生的事件.当点击一个按钮时,通常会产生两个或者三个事件--按钮按下,这是事件一,如果滑动几下,这是事件二,当手抬起,这是事件三.所以在And ...

  2. “SqlDateTime 溢出。必须介于 1/1/1753 12:00:00 AM 和 12/31/9999 11:59:59 PM 之间。”

    原因: .NET中  DateTime最小值为: 0001-1-1 0:00:00 数据库中DateTime最小值为: 1753-1-1 0:00:00, 很明显:.NET中的最小值超出了数据库时间类 ...

  3. SEO技巧之WordPress篇幅

    随着搜索引擎大兴, 排列在前的网站引入大量流量. 无论是搜索页面的广告还是查出来的结果, 与搜索者的目标匹配度都比较高 (如果搜索引擎足够智能), 所以通过搜索引擎而来的访客很可能会从网站上得到他想要 ...

  4. FPGA的引脚VCCINT 、VCCIO VCCA

    首先是看到FPGA在配置的时候有三种不同的电VCCINT .VCCIO VCCA,于是就查了下有什么不同: FPGA一般会有许多引脚,那它们都有什么用呢? VCCINT为施加于 FPGA 内核逻辑的电 ...

  5. android Can't bind to local 86XX for debugger

    For some reason eclipse DDMS always gives the error 'Can't bind to local 86XX for debugger' every ti ...

  6. JS 常用验证REG

    不错的JS验证~~~~~~~~~~~~~~~~~~~~~~~~~ 用途:校验ip地址的格式 输入:strIP:ip地址 返回:如果通过验证返回true,否则返回false: */ function i ...

  7. perl use FileHandle;打开多个文件

    use FileHandle;my %fh; my @filehandlename=("A","B","C"); ##文件句柄的名字: fo ...

  8. [moka同学笔记]八、Yii2.0课程笔记(魏曦老师教程)[授权]

    数据库表创建 在执行yii rbac/init之前,需要在 \console\controllers\RbacController.php中 <?php namespace console\co ...

  9. 在Eclipse中使用Junit进行单元测试练习 实现最大子数组和算法

    1.如何在MAC OS X下安装配置java开发工具 http://www.cnblogs.com/coderL/p/5939541.html 2.最大子数组和算法 附上程序运行及测试截图,源码见后 ...

  10. 美女jquery图片播放器插件

    相册在线查看http://keleyi.com/keleyi/phtml/image/6.htm 可全屏,可拖动,可自动播放的jquery图片展示插件 使用说明:1.引用css文件:<link ...