How to get queue name with the help of topic subscription

Hi Team,
I have a case where i need to get the queue name with the help of topic subscription.I have only topic name which is bind to queue. How can we achieve with the help of SEMP API's
Thanks in advance.

Comments

  • ChristianHoltfurth
    ChristianHoltfurth Member, Employee Posts: 75 Solace Employee

    Hi @tejaschowsalkar ,
    Can you elaborate on your use case a bit more?
    A queue is ultimately something that is owned by an application that can then apply subscriptions to it (or have them applied by an admin) in order to attract messages to it. In other words it should be well know to the application owning the queue. Why are you trying to find a queue (or queues?) based on a subscription?
    Are you looking to figure out how many apps have subscribed to a specific topic?
    Keep in mind that Solace supports wildcards, so there may be many many different permutation of subscriptions that could attract a specific topic.

  • tejaschowsalkar
    tejaschowsalkar Member Posts: 13

    Hi ChristianHoltfurth
    Thanks for your time, Publishers are publishing a message to a topic and we lack the topic subscription to queue mapping t track the details.
    Thanks

  • ChristianHoltfurth
    ChristianHoltfurth Member, Employee Posts: 75 Solace Employee

    Sorry, I didn't quite get the use case. Can you elaborate on what and why you are trying to track?
    Maybe there's multiple ways to achieve what you are looking for.

  • tejaschowsalkar
    tejaschowsalkar Member Posts: 13

    the thing is that our users know only topic names as they publishing to topic only,in case of any issues it becomes quite difficult to get the exact queue name with the help topic name only,trying to build some external app to link topics & queues.
    I hope that helps to understand,is there anyway to achieve this please lte m know.

  • ChristianHoltfurth
    ChristianHoltfurth Member, Employee Posts: 75 Solace Employee

    Yes, there is a way - I believe.
    You could use the SEMPv2 API to query all the queues, then look at the topic subscriptions on these queues to find matches to your topic. See https://docs.solace.com/API-Developer-Online-Ref-Documentation/swagger-ui/monitor/index.html#/queue/getMsgVpnQueueSubscription
    You would have to implement some logic though to do the wildcard matching to your topic in question.

    I was asking for the use case, because in case you are implementing an event driven architecture, then it's actually good practice for the publisher to not know or even care who is subscribing to the topics they are publishing on.
    If you are using Event Portal, you could also use this as your source of truth as you would hopefully have all your events and subscriptions documented there (including the endpoints) and it would be easy to find any subscribers from there.

    I'm not sure if I got your use case, but sounds like you want to know the subscribed queues in case of an error condition, something like one of the subscribed queues being full and the publisher getting a NACK due to this (queue with reject message to sender on discard set to true?
    I'm not entirely sure, but doesn't the NACK also include some detail as to which endpoint caused the NACK?

  • tejaschowsalkar
    tejaschowsalkar Member Posts: 13

    Yes,but for this we have to pass queuename as parameter,whereas in my use case i dont know the queue name,we dont have event portal yet in place.

  • tejaschowsalkar
    tejaschowsalkar Member Posts: 13

    what change needs to be done in semp request in order to get the subscriptions of all queues on the broker?

  • ChristianHoltfurth
    ChristianHoltfurth Member, Employee Posts: 75 Solace Employee

    Yes, I think you need to first get the list of queues via:
    https://docs.solace.com/API-Developer-Online-Ref-Documentation/swagger-ui/monitor/index.html#/queue/getMsgVpnQueues
    Then iterate over those to find the ones with the subscription you are looking for.