How to find out what subscriptions a client has

Options
TomF
TomF Member, Employee Posts: 406 Solace Employee

Firstly, there are two types of “subscribers” in Solace:

  • Direct client subscribers, who get messages directly from a topic. These are typically market data style clients, who do not need a guarantee of no data loss;
  • Queue consumers. These clients cannot tolerate any message loss. The queue itself subscribes to the topic.

Interactively using PubSub+ Broker Manager

To find out who is subscribing interactively using PubSub+ Broker Manager, open your web browser and open the broker IP address (e.g. solace-appliance1). You’ll see the PubSub+ Broker Manager open up. Click on the Message VPN of interest, then on the “Client Connections” menu item on the left. This will open the Client Connections Screen. Click “Solace Clients” and you should see a list of clients like this:

The top entry is my client of interest: there is no # at the beginning of its name (a # at the start of a client name represents a system client) and you can see the name starts with my laptop name. Click on the client name, then “Subscriptions” across the top and you should see something like:

Here you can see my client is subscribed to “another/topic”. The “#P2P” topic is the system generated unique topic used for request/reply messages.

Now let’s imagine my client is consuming from a queue. This time, in the Client Connections screen, open the “Consumers” tab:

You can see this time my client is consuming from Queue “Q”. So I go the queues menu item on the left hand side and pick Queue Q, the select the “Subscriptions” tab at the top of that screen. I can now see the subscriptions that Queue “Q” has and so my client is currently consuming from the queue:

Using CLI

If you’d like to use the CLI, the following commands are what you need:

For direct (non-queued) subscriptions: show client <client name> subscriptions

To find which queue a client is consuming from:

show client Thomass-MacBook-Pro-6.local/3116/#000a0001/wHB7-ReDdO message-spool and look for “Message Spool Egress,” something like this:

Message Spool
  Egress                                    Name /                
  FlowId    Established             Type    Transacted Session Name
  --------- ----------------------- ------- --------------------------------
  1         2021-02-11 10:06:14 UTC queue   Q  

So here we can see we’re consuming from Queue Q. To find the subscriptions on queue Q:

show queue <name> message-vpn <name> subscriptions

Using the API (SEMP)

If you need to get the subscriptions programmatically, you can use our REST based API, SEMP.

To get the subscrptions for a client, use GET SEMP/v2/monitor/msgVpns/{msgVpnName}/clients/{clientName}/subscriptions

To get the subscriptions on a queue,

get the TxFlows (a flow is a broker object that sends messages from a queue) for your client: GET SEMP/v2/monitor/msgVpns/{msgVpnName}/clients/{clientName}/txFlows
Look up the endpoint from the flow of interest: GET SEMP/v2/monitor/msgVpns/{msgVpnName}/clients/{clientName}/txFlows/{flowId}, and look for the “endpoint” field
use GET SEMP/v2/config/msgVpns/{msgVpnName}/queues/{queueName}/subscriptions

Comments