Search code examples
jmssolace

What is the preferable way to get size (bytes) and count of messages in the solace queue(JMX, OueueBrowser or else)?


Before push the messages into the queue, I would like to get how many messages and their size is.


Solution

  • You can issue a SEMP request over the message bus from your application to retrieve the size and count of messages in a specific Solace queue. Note that access to show commands over the message bus must be enabled in the message VPN that the client is connecting to.

    The SEMP command to retrieve details (including size) of each message in a queue is:

    <rpc semp-version="soltr/7_2">
        <show>
            <queue>
                <name>queueName</name>
                <vpn-name>vpnName</vpn-name>
                <messages></messages>
                <detail></detail>
            </queue>
        </show>
    </rpc>
    

    The SEMP request to retrieve high level details (including total size and message count) of a queue is:

    <rpc semp-version="soltr/7_2">
        <show>
            <queue>
                <name>queueName</name>
                <vpn-name>vpnName</vpn-name>
                <detail></detail>
            </queue>
        </show>
    </rpc>
    

    For more information regarding SEMP over the message bus, please refer to the Message Bus and Events Management section of the documentation, available here: https://sftp.solacesystems.com/Portal_Docs/#page/Message_Bus_and_Events_Management/Using_SEMP_to_Manage_and_Monitor_Routers.html#

    Using a Queue Browser is another option to view the sizes and count of messages in a Solace queue. A Queue Browser will create a non-consuming flow to the queue in order to view spooled messages. More information about creating Queue Browsers is available here: https://sftp.solacesystems.com/Portal_Docs/#page/Solace_Messaging_APIs_Developer_Guide/Receiving_Guaranteed_Messages.html#ww644833

    The preferable method depends on your use case. If you wish to view the entire contents of each individual message, a Queue Browser should be used. If you wish to only view high level details about a queue, a SEMP request may be preferable.