Bhavesh Kharwa
Bhavesh Kharwa

Reputation: 73

ActiveMQ Artemis: Get a list of all queues

There is an option in artemis web console to get list of all queues.

http://localhost:8161/console/jolokia/exec/org.apache.activemq.artemis:broker=%22localhost%22/listQueues(java.lang.String,int,int)

How can I get list of all queues using curl command with passing this above url or is there any other way to get list of all queue?

I am using artemis 2.11.0

Upvotes: 2

Views: 6018

Answers (2)

The listQueues operation is useful to filter or paging the list of the queues. It has 3 parameters options, page, and pageSize. The options is a JSON string to filter the queues, ie {"field": "", "operation": "", "value": ""}. The page and pageSize parameters allow to paging the result, ie to get the first 100 queues that contain in the name 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} is the request origin matching the restriction defined by the tag allow-origin in the jolokia-access.xml file.

${BROKER_ENDPOINT} is the endpoint of broker HTTP Server defined by the attribute bind of the tag web in the bootstrap.xml file.

${BROKER_NAME} is the broker name defined by the tag name in the broker.xml file.

Using the default values, the command becomes:

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

Upvotes: 4

Justin Bertram
Justin Bertram

Reputation: 35207

The listQueues method is really for the artemis queue stat command available from the command-line. It takes special input parameters to support paged output and various return parameters.

If you want to get a list of queues from the broker your best option would be the getQueueNames method. You can use something like the following curl command:

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"

Upvotes: 2

Related Questions