ActiveMQ Artemis:获取所有队列的列表
ActiveMQ Artemis: Get a list of all queues
artemis web 控制台中有一个选项可以获取所有队列的列表。
http://localhost:8161/console/jolokia/exec/org.apache.activemq.artemis:broker=%22localhost%22/listQueues(java.lang.String,int,int)
如何使用 curl 命令获取所有队列的列表并在上面传递 url 或者是否有任何其他方法获取所有队列的列表?
我正在使用 artemis 2.11.0
listQueues
方法实际上适用于命令行中可用的 artemis queue stat
命令。它需要特殊的输入参数来支持分页输出和各种 return 参数。
如果您想从代理获取队列列表,最好的选择是 getQueueNames
方法。您可以使用类似下面的 curl
命令:
curl -s -k --user admin:admin -H "Origin: http://localhost:8161" "http://localhost:8161/console/jolokia/read/org.apache.activemq.artemis:broker=%22localhost%22/QueueNames"
listQueues
操作对于过滤或分页队列列表很有用。它有 3 个参数 options
、page
和 pageSize
。 options
是一个 JSON 字符串来过滤队列,即 {"field": "", "operation": "", "value": ""}。 page
和 pageSize
参数允许对结果进行分页,即获取名称中包含的前 100 个队列 TEST
:
curl -H "Origin:${REQUEST_ORIGIN}" -u admin:admin http://${BROKER_ENDPOINT}/console/jolokia/exec/org.apache.activemq.artemis:broker=%22${BROKER_NAME}%22/listQueues/%7B%22field%22:%22name%22%2C%22operation%22:%22CONTAINS%22%2C%22value%22:%22TEST%22%7D/1/100
${REQUEST_ORIGIN} 是与 jolokia-access.xml
文件中的标签 allow-origin
定义的限制相匹配的请求来源。
${BROKER_ENDPOINT} 是由 bootstrap.xml
文件中标签 web
的属性 bind
定义的代理 HTTP 服务器端点。
${BROKER_NAME} 是由 broker.xml
文件中的标签 name
定义的代理名称。
使用默认值,命令变为:
curl -H "Origin:http://localhost" -u admin:admin http://localhost:8161/console/jolokia/exec/org.apache.activemq.artemis:broker=%220.0.0.0%22/listQueues/%7B%22field%22:%22name%22%2C%22operation%22:%22CONTAINS%22%2C%22value%22:%22TEST%22%7D/1/100
artemis web 控制台中有一个选项可以获取所有队列的列表。
http://localhost:8161/console/jolokia/exec/org.apache.activemq.artemis:broker=%22localhost%22/listQueues(java.lang.String,int,int)
如何使用 curl 命令获取所有队列的列表并在上面传递 url 或者是否有任何其他方法获取所有队列的列表?
我正在使用 artemis 2.11.0
listQueues
方法实际上适用于命令行中可用的 artemis queue stat
命令。它需要特殊的输入参数来支持分页输出和各种 return 参数。
如果您想从代理获取队列列表,最好的选择是 getQueueNames
方法。您可以使用类似下面的 curl
命令:
curl -s -k --user admin:admin -H "Origin: http://localhost:8161" "http://localhost:8161/console/jolokia/read/org.apache.activemq.artemis:broker=%22localhost%22/QueueNames"
listQueues
操作对于过滤或分页队列列表很有用。它有 3 个参数 options
、page
和 pageSize
。 options
是一个 JSON 字符串来过滤队列,即 {"field": "", "operation": "", "value": ""}。 page
和 pageSize
参数允许对结果进行分页,即获取名称中包含的前 100 个队列 TEST
:
curl -H "Origin:${REQUEST_ORIGIN}" -u admin:admin http://${BROKER_ENDPOINT}/console/jolokia/exec/org.apache.activemq.artemis:broker=%22${BROKER_NAME}%22/listQueues/%7B%22field%22:%22name%22%2C%22operation%22:%22CONTAINS%22%2C%22value%22:%22TEST%22%7D/1/100
${REQUEST_ORIGIN} 是与 jolokia-access.xml
文件中的标签 allow-origin
定义的限制相匹配的请求来源。
${BROKER_ENDPOINT} 是由 bootstrap.xml
文件中标签 web
的属性 bind
定义的代理 HTTP 服务器端点。
${BROKER_NAME} 是由 broker.xml
文件中的标签 name
定义的代理名称。
使用默认值,命令变为:
curl -H "Origin:http://localhost" -u admin:admin http://localhost:8161/console/jolokia/exec/org.apache.activemq.artemis:broker=%220.0.0.0%22/listQueues/%7B%22field%22:%22name%22%2C%22operation%22:%22CONTAINS%22%2C%22value%22:%22TEST%22%7D/1/100