How can you find topics that have no subscriptions?

JamilAhmed
JamilAhmed Member, Employee Posts: 20 Solace Employee
edited February 2022 in PubSub+ Event Broker #1

A publisher can be producing events on a topic that have no interested consumers.

Is there a way to list those topics for the purposes of clean-up or decommission of unused flows?

This condition would also be causing the client counter Ingress Discard - No Subscription Match to increment.

Best Answer

  • JamilAhmed
    JamilAhmed Member, Employee Posts: 20 Solace Employee
    #2 Answer ✓

    The broker maintains an in-memory rolling log of these topics, at a maximum of 1000 entries.

    This log can be viewed within the CLI with the following command:

    > show log no-subscription-match

    > show log no-subscription-match message-vpn myVPN

    This same command can also be issued over SEMPv1 with the following request XML:

    <rpc>
      <show>
        <log>
          <no-subscription-match>
            <vpn-name>myVPN</vpn-name>
          </no-subscription-match>
        </log>
      </show>
    </rpc>
    

    A curl example would be like so:

    curl -d @get-no-subscription-match.xml -u user:pass https://broker-hostname:943/SEMP

    where the file get-no-subscription-match.xml contains the above request XML.

    The response contains an entry for the published topic each time it was published to, along with details of the client-name and client-username.

    <rpc-reply semp-version="soltr/9_10VMR">
     <rpc>
      <show>
       <log>
        <no-subscription-match>
         <entry>
          <client-name>solclientjs/chrome-98.0.4758-Windows-0.0.0/3560415772/0001</client-name>
          <client-username>solace-cloud-client</client-username>
          <vpn-name>myVPN</vpn-name>
          <topic>testing/no-sub/match</topic>
         </entry>
         <entry>
          <client-name>solclientjs/chrome-98.0.4758-Windows-0.0.0/3560415772/0001</client-name>
          <client-username>solace-cloud-client</client-username>
          <vpn-name>myVPN</vpn-name>
          <topic>testing/no-sub/match</topic>
         </entry>
        </no-subscription-match>
       </log>
      </show>
     </rpc>
    <execute-result code="ok"/>
    </rpc-reply>
    


Answers

  • JamilAhmed
    JamilAhmed Member, Employee Posts: 20 Solace Employee
    #3 Answer ✓

    The broker maintains an in-memory rolling log of these topics, at a maximum of 1000 entries.

    This log can be viewed within the CLI with the following command:

    > show log no-subscription-match

    > show log no-subscription-match message-vpn myVPN

    This same command can also be issued over SEMPv1 with the following request XML:

    <rpc>
      <show>
        <log>
          <no-subscription-match>
            <vpn-name>myVPN</vpn-name>
          </no-subscription-match>
        </log>
      </show>
    </rpc>
    

    A curl example would be like so:

    curl -d @get-no-subscription-match.xml -u user:pass https://broker-hostname:943/SEMP

    where the file get-no-subscription-match.xml contains the above request XML.

    The response contains an entry for the published topic each time it was published to, along with details of the client-name and client-username.

    <rpc-reply semp-version="soltr/9_10VMR">
     <rpc>
      <show>
       <log>
        <no-subscription-match>
         <entry>
          <client-name>solclientjs/chrome-98.0.4758-Windows-0.0.0/3560415772/0001</client-name>
          <client-username>solace-cloud-client</client-username>
          <vpn-name>myVPN</vpn-name>
          <topic>testing/no-sub/match</topic>
         </entry>
         <entry>
          <client-name>solclientjs/chrome-98.0.4758-Windows-0.0.0/3560415772/0001</client-name>
          <client-username>solace-cloud-client</client-username>
          <vpn-name>myVPN</vpn-name>
          <topic>testing/no-sub/match</topic>
         </entry>
        </no-subscription-match>
       </log>
      </show>
     </rpc>
    <execute-result code="ok"/>
    </rpc-reply>