Selecting queues from SEMP monitor api where message count > 0 ?

Options
petegehrman
petegehrman Member Posts: 43 ✭✭

Is there any way to query queues from SEMP and filter based on the message count? If I try to add a where clause to the URL with msgs.count I get the following error: "where query error: Collection 'msgs' not allowed". If not, I'll just load all queues and filter in my application.

Thanks,
Pete

Best Answer

  • brenda
    brenda Member, Employee Posts: 9 Solace Employee
    edited October 2021 #2 Answer ✓
    Options

    The current number of messages in the queue can be gotten by querying the queue for all its messages, and looking at the "count" element in the "meta" element. There is no way to pull the stuff in the "meta" element out using the query filters. You do not have to actually get all the messages - every page of results will have the count of all currently spooled messages in its meta section.

Answers

  • nram
    nram Member, Employee Posts: 80 Solace Employee
    edited October 2021 #3
    Options

    Peter, Can you try something like the below ?

    http://{{BROKER}}:{{PORT}}/SEMP/v2/monitor/msgVpns/{{VPN}}/queues?select=queueName,spooledMsgCount&where=spooledMsgCount>10
    
    
  • petegehrman
    petegehrman Member Posts: 43 ✭✭
    Options

    The spooledMsgCount metric appears to be the cumulative number of messages spooled over time, not the current number of messages in the queue.

  • nram
    nram Member, Employee Posts: 80 Solace Employee
    Options

    Ah, I see your predicament. The currentMsgsSpooled is in the meta section, not data and hence not available for filtering. Let me check internally if this possible.

  • brenda
    brenda Member, Employee Posts: 9 Solace Employee
    edited October 2021 #6 Answer ✓
    Options

    The current number of messages in the queue can be gotten by querying the queue for all its messages, and looking at the "count" element in the "meta" element. There is no way to pull the stuff in the "meta" element out using the query filters. You do not have to actually get all the messages - every page of results will have the count of all currently spooled messages in its meta section.

  • petegehrman
    petegehrman Member Posts: 43 ✭✭
    Options

    Thanks, I'll filter the queues then in my application after I query all of them. Just wanted to make sure I wasn't missing a way for the broker to do that for me.

  • hong
    hong Guest Posts: 480 ✭✭✭✭✭
    Options

    @petegehrman Can you accept the best answer by clicking "Did this answer the question? Yes" in the answer? This will help the other members of the community. Thanks!