'Get the number of receiving subscriptions of a Azure Service Bus Message

Is there a way to get the number of receiving subscriptions of a ServiceBusMessage sent on a Topic, in any of the two following ways:

  1. The number of subscriptions that have been successfully enqueued (preferable)
  2. The number of subscriptions that are supposed to be enqueued (not preferable, but good enough)

I could go the hacky route of comparing the ServiceBusMessage filter properties with the RuleProperties of the topic and its subscriptions (via a ServiceBusAdministrationClient), but that would limit me to the second of the two alternatives listed above.

My use-case:

I have the Claim-Check Pattern implemented and want to know when I can safely clear the Claim-checked payloads, without having to wait for the message expiration.

My setup:
  • .Net 6 in-process FunctionApp
  • Azure.Messaging.ServiceBus 7.6.0
  • Microsoft.Azure.WebJobs.Extensions.ServiceBus 5.2.0


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source