I see the problem now. Using your original method you shouldn't have put quotation marks around __AMQ_CID. This works:
curl -v -s http://admin:admin@localhost:8161/console/jolokia/exec/org.apache.activemq.artemis:broker=\"0.0.0.0\",component=addresses,address=\"Q.test\",subcomponent=queues,routing-type=\"anycast\",queue=\"Q.test\"/countMessages\(java.lang.String,java.lang.String\)/\"\"/__AMQ_CID/ -H "Origin: http://localhost" Justin On Thu, Nov 14, 2024 at 5:23 PM Justin Bertram <jbert...@apache.org> wrote: > That's very strange. I can't get it to work with your URL either. However, > I did get it to work with this: > > $ curl -s -H "Origin: http://localhost" -u admin:admin --header > "Content-type: application/json" --request POST --data '{"operation": > "countMessages(java.lang.String,java.lang.String)", "mbean": > "org.apache.activemq.artemis:broker=\"0.0.0.0\",component=addresses,address=\"Q.test\",subcomponent=queues,routing-type=\"anycast\",queue=\"Q.test\"", > "type": "exec", "arguments": [ "", "__AMQ_CID" ] }' > http://localhost:8161/console/jolokia | jq '.value | fromjson' > { > "carol": 10, > "bob": 10, > "alice": 10 > } > > This is an alternative way to use Jolokia using a POST instead of a GET. > > > Justin > > On Thu, Nov 14, 2024 at 4:56 PM Keith Herbert <kherb...@redhat.com> wrote: > >> I'm stumped again. I'm recreating the above using curl commands instead of >> the web console and it doesn't seem like groupByProperty is being >> recognized. >> >> apache-artemis-2.33.0.redhat-00013/bin/artemis create groupby >> >> >> Edit groupby/etc/broker.xml with >> >> <address-setting match="#"> >> >> <management-browse-page-size>99999999</management-browse-page-size> >> >> ... >> >> </address-setting> >> >> >> >> groupby/bin/artemis start >> >> groupby/bin/artemis producer --url tcp://localhost:61616 --destination >> Q.test --user admin --password admin --message-count 10 --clientID alice >> groupby/bin/artemis producer --url tcp://localhost:61616 --destination >> Q.test --user admin --password admin --message-count 10 --clientID bob >> >> groupby/bin/artemis producer --url tcp://localhost:61616 --destination >> Q.test --user admin --password admin --message-count 10 --clientID carol >> >> >> >> curl http://admin:admin@localhost >> :8161/console/jolokia/read/org.apache.activemq.artemis:broker=\"0.0.0.0\",component=addresses,address=\"Q.test\" >> -H "Origin: http://localhost" | jq .value.QueueNames >> >> > ["Q.test"] >> >> >> curl http://admin:admin@localhost >> :8161/console/jolokia/exec/org.apache.activemq.artemis:broker=\"0.0.0.0\",component=addresses,address=\"Q.test\",subcomponent=queues,routing-type=\"anycast\",queue=\"Q.test\"/countMessages\(java.lang.String,java.lang.String\)/\"\"/\"__AMQ_CID\"/ >> -H "Origin: http://localhost" | jq .value >> >> > "{\"null\": 30}" >> >> I can see with browse() that the __AMQ_CID property is present >> >> curl >> http://admin:admin@localhost >> :8161/console/jolokia/exec/org.apache.activemq.artemis:broker=\"0.0.0.0\",component=addresses,address=\"Q.test\",subcomponent=queues,routing-type=\"anycast\",queue=\"Q.test\"/browse\(\) >> <http://admin:admin@localhost >> :8161/console/jolokia/exec/org.apache.activemq.artemis:broker=/% >> 220.0.0.0/%22,component=addresses,address=/%22Q.test/%22,subcomponent=queues,routing-type=/%22anycast/%22,queue=/%22Q.test/%22/browse/(/) >> > >> -H "Origin: http://localhost" | jq .value >> >> *...,* >> >> { >> >> "address": "Q.test", >> >> "messageID": "146", >> >> ... >> >> "StringProperties": { >> >> "ThreadSent": "Producer ActiveMQQueue[Q.test], thread=0", >> >> "__AMQ_CID": "dan" >> >> }, >> >> ... >> >> "PropertiesText": "{ThreadSent=Producer ActiveMQQueue[Q.test], >> thread=0, __AMQ_CID=dan, count=0, _AMQ_ROUTING_TYPE=1}", >> >> ... >> >> } >> >> Am I missing something in the Jolokia url? >> >> Thanks in advance, >> >> Keith >> >> On Thu, Nov 14, 2024 at 9:29 AM Keith Herbert <kherb...@redhat.com> >> wrote: >> >> > That fixed it. Thank you very much! >> > >> > <address-setting match="exampleQueue"> >> > >> <management-browse-page-size>999999999</management-browse-page-size> >> > </address-setting> >> > >> > {"barney":1000,"moe":1000,"homer":1000} >> > >> > >> > On Thu, Nov 14, 2024 at 4:55 AM Domenico Francesco Bruscino < >> > bruscin...@gmail.com> wrote: >> > >> >> Hi Keith, >> >> >> >> you are hitting the default management-browse-page-size value: 200. For >> >> further details see >> >> >> >> >> https://activemq.apache.org/components/artemis/documentation/latest/address-settings.html#address-settings >> >> >> >> Regards, >> >> Domenico >> >> >> >> On Wed, 13 Nov 2024 at 22:28, Keith Herbert <kherb...@redhat.com> >> wrote: >> >> >> >> > I'm stumped by how to use the filter for countMessages(String, >> String) >> >> in >> >> > the console view for queue operations. My goal is to get a count of >> >> > messages grouped by clientID. >> >> > >> >> > I boot up a broker and send 3000 messages with 3 different clientIDs. >> >> > >> >> > bin/artemis producer --destination exampleQueue --url >> >> > tcp://localhost:61616 --user admin --password password --clientID >> homer >> >> > bin/artemis producer --destination exampleQueue --url >> >> > tcp://localhost:61616 --user admin --password password --clientID >> barney >> >> > bin/artemis producer --destination exampleQueue --url >> >> > tcp://localhost:61616 --user admin --password password --clientID moe >> >> > >> >> > In the console, I get 3000 messages for messageCount(), and >> >> > messageCount(String) with an empty filter. I can see the _AMQ_CID >> >> property >> >> > is set on the messages with browse(). >> >> > >> >> > "StringProperties": { >> >> > "ThreadSent": "Producer ActiveMQQueue[exampleQueue], thread=0", >> >> > "__AMQ_CID": "homer" >> >> > }, >> >> > >> >> > But the result for countMessages("", "__AMQ_CID") is nonsensical. It >> >> only >> >> > returns {"homer":200} when I expect a list of homer, barney, and moe >> >> each >> >> > with 1000 messages. >> >> > >> >> > [image: image.png] >> >> > >> >> > I couldn't find any reference to this in the docs or find any >> >> > examples/unit tests using the groupByProperty. Thanks for any help. >> >> > >> >> > >> >> >> > >> >