Thomas
Thomas

Reputation: 2126

Azure Service Bus Topic Receiving messages

Referring to https://github.com/Azure/azure-service-bus/tree/master/samples/DotNet/GettingStarted/Microsoft.Azure.ServiceBus/BasicSendReceiveUsingTopicSubscriptionClient, I understand how Azure Service Bus Topics work in general, my question is more about how it actually works.

When a MesageHandler is registered (subscriptionClient.RegisterMessageHandler), it starts receiving messages as I see in

Console.WriteLine($"Received message: SequenceNumber:{message.SystemProperties.SequenceNumber} Body:{Encoding.UTF8.GetString(message.Body)}");

However, my question is whether the client actually receives the messages using a pull mode or it is a push from the Service Bus? Is there a continuous polling done by the Client to receive the messages - how does this work internally?

Upvotes: 3

Views: 603

Answers (1)

Sean Feldman
Sean Feldman

Reputation: 26057

The client is performing a long-poll. I.e. it will ask for a message and wait for it. If after a timeout period of one minute nothing is returned, it will poll again. In case a message is available before timeout expires, the message will be given to the message handler and polling will start again. Azure Service Bus does not push messages to the clients.

Upvotes: 4

Related Questions