Azure Service Bus - Brokered connection

Sayed Reda 30 Reputation points
2023-05-25T13:30:22.4733333+00:00

I have an Azure Function which runs almost continously and it has a singleton ServiceBusClient (it does not get disposed). Azure function sends many messages in batches (ServiceBusMessageBatch) to multiple topics for that Azure Service Bus. So is it counted as only 1 brokered connection or no?

if no then why? and how are the brokered connections counted in Azure Service Bus?

Azure Service Bus
Azure Service Bus
An Azure service that provides cloud messaging as a service and hybrid integration.
700 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Sedat SALMAN 14,180 Reputation points MVP
    2023-05-25T14:42:07.8333333+00:00

    When you create a ServiceBusClient instance and use it to send messages to a topic, it will open a single-brokered connection that it uses for all operations. This connection stays open for as long as the ServiceBusClient instance is alive, and it's used for all operations that you perform using this client, including sending messages to multiple topics. Therefore, if you have a singleton ServiceBusClient that you're using to send messages to multiple topics, this would typically count as a single brokered connection, provided that all these operations are happening concurrently in the same process. In a nutshell, the number of brokered connections is generally equivalent to the number of ServiceBusClient instances that are actively communicating with the Service Bus service.

    So, while a singleton ServiceBusClient within a single process would generally count as a single brokered connection, the actual number of brokered connections can vary depending on the specifics of your application and how it interacts with the Service Bus service.

    1 person found this answer helpful.

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.