What is the best way to get the actual queue message count ?

Robert
Robert Member Posts: 58 ✭✭

I am using currently Jcsmp and sure i can use queue browser to fetch all data and check collection size but there should be an easier way to check queue size without fetching all data.

So i find this one:
https://solace.community/discussion/398/how-to-check-the-size-of-a-message-queue

But when i run towards my docker image Version 9.12.0.15 it does not work.

I ran following curl command:
curl --location --request GET 'http://localhost:8080/SEMP/v2/config/msgVpns/default/queues/MHS_ORDER_UPDATE_DMQ?select=msgs.count'

So the select=msgs.count seems not to work.
Without all works fine.

So help would be highly appreciated.
Many thanks in advance.

Tagged:

Best Answer

Answers

  • ivan_lkc
    ivan_lkc Member Posts: 11 ✭✭

    What is the minor SEMP version?
    This can be obtained by visiting http://localhost:8080/SEMP/v2/config/help.
    See the red circle in this sample:

  • Robert
    Robert Member Posts: 58 ✭✭

    I run the docker version. Did not check if a newer one is available:
    Version 9.12.0.15

    SEMP: 2.24

  • Robert
    Robert Member Posts: 58 ✭✭

    I tried this but maybe it is wrong. Just found some info in some threads:

  • ivan_lkc
    ivan_lkc Member Posts: 11 ✭✭

    According to official 2.24 online documentation, the response won't contain "msgs.count". You can remove the portion "?select=msgs.count" and inspect the whole output to confirm this.

    As an alternative, try this URL instead:
    http://localhost:8080/SEMP/v2/config/msgVpns/default/queues/MHS_ORDER_UPDATE_DMQ/msgs?count=1
    And then from the response JSON, extract the path "meta.count".

    Note that you should not use "?select=meta.count" because anything under "meta" is not currently eligible for filtering.

  • Robert
    Robert Member Posts: 58 ✭✭
    edited December 2021 #7

    I tried that but did not work:
    That works:

    that does not work:

  • Robert
    Robert Member Posts: 58 ✭✭

    I think it would be great to get clarity on that things. It seems that solace added or is on the way to add a collection objects to return from queue.

    I can see that it does not return a collection:

    The ones for whom likely msgs?count=1 could work is some people who use already some newer versions but not the public ones.

    On SEMPV2 API spec it does not mention any collection:

    So it feels that some solace people maybe already using some beta or internal version are confusing likely customers with features which are even not public yet.

    See discussions here where someone gets back a collection object.
    So best for all clients would be to try things out on latest public release.
    Sure it is great to give a hint that there will be soon a new release which supports then
    to return a collection and with that the message count.

  • Aaron
    Aaron Member, Administrator, Moderator, Employee Posts: 634 admin
    edited December 2021 #9 Answer ✓

    Don't use the config API. That's for configuration. You want to use the monitor API, to view current stats / metrics.

    https://docs.solace.com/API-Developer-Online-Ref-Documentation/swagger-ui/monitor/index.html

  • Robert
    Robert Member Posts: 58 ✭✭
    edited December 2021 #10

    @Aaron That made the trick. I just wonder what the collection is intended for ?
    To later return the content ? Now it is empty. Is that for future to maybe return even content ?

    The best now to get the count is to run query and check meta.count, right ?

  • Aaron
    Aaron Member, Administrator, Moderator, Employee Posts: 634 admin

    No, you don't want to use that command... that gets the details about individual messages. Just look at the queue metrics: https://docs.solace.com/API-Developer-Online-Ref-Documentation/swagger-ui/monitor/index.html#/queue/getMsgVpnQueues

    In the response, right at the top, it lists the queue depths:

    $ curl http://localhost:8080/SEMP/v2/monitor/msgVpns/default/queues -u admin:admin
    {
        "collections":[
            {
                "msgs":{
                    "count":11                   <----
                },
                "priorities":{},
                "subscriptions":{},
                "txFlows":{}
            },
            {
                "msgs":{
                    "count":1079                <-----
                },
                "priorities":{},
                "subscriptions":{},
                "txFlows":{}
            }
        ],
    SNIP
    

    Alternatively, if monitoring a very large number of queues, perhaps SEMPv1 might be more appropriate:

    curl http://localhost:8080/SEMP -u admin:admin -X POST -d '<rpc><show><queue><name>*</name><vpn-name>default</vpn-name></queue></show></rpc>'
    
    <rpc-reply semp-version="soltr/9_12VMR">
      <rpc>
        <show>
          <queue>
            <queues>
              <queue>
                <name>q/trans/rdp</name>
                <info>
                  <message-vpn>default</message-vpn>
                  <durable>true</durable>
                  <type>Primary</type>
                  <num-messages-spooled>11</num-messages-spooled>
                  <current-spool-usage-in-mb>0.00847721</current-spool-usage-in-mb>
                  <high-water-mark-in-mb>0.00847721</high-water-mark-in-mb>
                  <bind-count>0</bind-count>
                  <ingress-config-status>Up</ingress-config-status>
                  <egress-config-status>Up</egress-config-status>
                  <access-type>exclusive</access-type>
                  <egress-selector-present>No</egress-selector-present>
                  <quota>5000</quota>
                  <topic-subscription-count>2</topic-subscription-count>
                </info>
              </queue>
    SNIP
    
  • Robert
    Robert Member Posts: 58 ✭✭

    @Aaron your sample i guess gives a metric across all queues. i look for the message count of a single queue.
    Is it poassible to get metric as well for single queue?