C Api to get the queue size and other details.

crs86
crs86 Member Posts: 4
edited October 2020 in General Discussions #1

There is a new requirement for me to create solace queue monitoring project. Where I need to find the queue details on certain time interval and create a alert system. The requirement is to get the queue size and check with the defined size of the queue, if its close to the defined size create a alert.

So I am trying to find the solace api (C) to get the queue size. It would be a great help if I can get any details on it.

Tagged:

Comments

  • TomF
    TomF Member, Employee Posts: 412 Solace Employee

    Hi @crs86, I think we might be able to do this in an unexpectedly easy way. A lot depends on how much information you need about the queue. If all you need is a configurable threshold at which to generate the alert, then that facility already exists - see the queue threshold alerts, which are by default 80% high set, 60% clear and another alarm at 100%. These alerts are normally emitted over the syslog interface, but you can opt to have them sent as messages, too. In this case, all your monitoring application has to do is subscribe to the alert topics.
    The feature name is Message Bus Events, and the events are emitted to a topic of the form
    #LOG/<level>/VPN/<routerName>/<eventName>/<vpnName>

  • crs86
    crs86 Member Posts: 4
    edited October 2020 #3

    Hi Tom,
    Thanks for your prompt response. The feature you mentioned is completely useful. But in my case the requirement is different. I want to make API call on each second to get the queue details and I will have my own threshold defined parameter locally. I will compare the current queue filled details with the locally defined details. If both the values are close then I need to send the alert to the alert system.

    So achieve above functionality I have make API call to the solace system to get the queue details. I just want to know which API(C) should I call to get the queue details? I am using C API here for pubsub solace messaging.

    Thanks
    Chita

  • TomF
    TomF Member, Employee Posts: 412 Solace Employee

    Hi @crs86, I was hoping we can use some inbuilt features to do this the super easy way but as you say the queue threshold alerts don't do what you want. No problem!

    You'll need to use the SEMP protocol to query the queue details. You can do this in two ways:
    1. Via the SEMP (management) interface, with administrator user Ids.
    2. Using SEMP over the message bus , with client user ids.
    You might find SEMP over the message bus easier as it allows you to use the normal messaging interface.

    Please be aware of the SEMP polling guidelines - polling queues once every second is quite aggressive.

  • crs86
    crs86 Member Posts: 4

    Hi Tom, Thanks again for your quick and valuable response. I will check those details and post my findings if it could help me.

  • TomF
    TomF Member, Employee Posts: 412 Solace Employee

    Perfect. We always like to hear how you got on, so please do come back and tell us!

  • crs86
    crs86 Member Posts: 4

    Hi Tom, Back again with few more query :) . I have tried semp request over the message bus suing CAPI. I am able to create the session. However the problem here is while sending the request message using solClient_session_sendRequest function I am getting denial message. I have created a test app using sempGetOverMb.c example. Do you think we need a different user or some entitlements? I have provided the detailed message below. It will be great help if you can give your input on this.

    REQUEST:
    REQUEST ADDRESS: #SEMP/n
    ---/SHOW
    SDK NOTICE Mon Oct 19 23:37:23.471 2020 : tcp_TxRx message callback for session '(c0,s1)_FixMsg_****': respCode = 403, response string = 'Publish ACL Denied - Topic '#SEMP/n
    -***-***-***/SHOW'', client name 'DTCVDI-***-****/*****/#00000001', VPN name 'FixMsg_****', peer address 'IP ***.***.***.
    :*****', connection 'tcp_TxRx' local address 'IP ...:*****'
    common_eventCallback() called - Message rejected on session; subCode SOLCLIENT_SUBCODE_PUBLISH_ACL_DENIED, responseCode 403, reason Publish ACL Denied - Topic '#SEMP/n
    ---***/SHOW'
    SDK NOTICE Mon Oct 19 23:37:28.441 2020 : solClient_session_sendRequest for session '(c0,s1)_FixMsg_*****', timed out waiting for request reply wait
    APP ERROR Mon Oct 19 23:37:28.441 2020 : solClient_session_sendRequest() - ReturnCode="Incomplete", SubCode="SOLCLIENT_SUBCODE_TIMEOUT", ResponseCode=0, Info="Session send request timed out"

  • TomF
    TomF Member, Employee Posts: 412 Solace Employee

    Hey @crs86, don't worry, we'll get you there. The key line in the error is this one:
    Publish ACL Denied - Topic '#SEMP/n---***/SHOW'
    What this shows is that the ACL profile this client uses is not allowing you to publish on that topic. If you can find the ACL profile that client uses, look for the publish topic entry. It will probably look something like:

     Publish Topic Default Action : deny
        Exceptions : 1
    
        Syntax Topics
        ------ --------------------------------------------------------------------
        SMF  a/topic/you/can/publish/to
    

    If the #SEMP topic isn't in that list you'll get this error. See ACL Profiles in the docs for more details.