3

You can subscribe to asynchronous updates from Azure topics and queues by using SubscriptionClient/QueueClient's .OnMessage call which will presumably create a separate thread polling the topic/queue with default settings and calling a defined callback if it receives anything.

Azure website says that receiving a message is a billable action, which is understandable. However, it isn't clear enough if each those poll requests are considered billable even when they do not return anything, i.e. the queue in question has no pending messages.

Grozz
  • 8,317
  • 4
  • 38
  • 53

1 Answers1

2

Based on the Azure Service Bus Pricing FAQ - the answer to your question is yes

In general, management operations and “control messages,” such as completes and deferrals, are not counted as billable messages. There are two exceptions:

Null messages delivered by the Service Bus in response to requests against an empty queue, subscription, or message buffer, are also billable. Thus, applications that poll against Service Bus entities will effectively be charged one message per poll.

Setting and getting state on a MessageSession will also result in billable messages, using the same message size-based calculation described above.

Given the price is $0.01 per 10,000 messages, I don't think you should worry too much about that.

Community
  • 1
  • 1
Tommy
  • 39,592
  • 10
  • 90
  • 121
  • 1
    Thanks for verifying, it just seems counter-intuitive to provide a "convenience" polling mechanism where user is billed per each request, frequency of which is set somewhere in the defaults of provided mechanism. – Grozz Feb 10 '14 at 21:18
  • @Grozz - I can't find the specifics, but I believe that the OnMessage uses "long polling", meaning, it fires up, asks the queue for a message. If there is one, returns right away. Else, it keeps the connection open as long as it can waiting for a message. If your queue use is low, you might want to lower the ListenerCount to 1 or 2 to keep the number of threads issuing calls to a minimum. Also, if your messages are not time sensitive, you may be better off using a while(true) loop with a timer that backs off incrementally if no messages have been received in a certain time frame. – Tommy Feb 10 '14 at 21:24
  • @Grozz - the second part probably isnt too clear, but I ran out of comment space. There are examples of using the "older" method of queue listening that do not rely on the `.OnMessage()` handlers – Tommy Feb 10 '14 at 21:25
  • @Tommy if it uses long-polling and server push then it should be fine, I was under the impression that it just polls with a timer under the hood. Thanks, I should probably test the number of requests to really know what's going on. – Grozz Feb 10 '14 at 21:35
  • @Grozz Have you tried this out? What were your findings? – Lonefish Nov 18 '16 at 08:45