Windows Azure Service Bus billing
I have a question about the azure bilingual splint. If I have the following code and the message hasn't been sent for a long time, say 5 hours.
Suppose I only have one subscription and the code is below. In this scenario, during this 5 hour period, what do I get the fees for (is it once for submit and once for upload, or am I taking on a survey fee to keep that azure is running in the background)?
enter code here
var subscriptionClient = SubscriptionClient.CreateFromConnectionString(ConnString, topic, subscriptionName);
while (true)
{
var message = subscriptionClient.Receive();
if (message != null)
{
try
{
message.Complete();
}
catch (Exception)
{
// Indicate a problem, unlock message in subscription
message.Abandon();
}
}
else
{
Console.WriteLine("null message received");
}
Thread.Sleep(25);
}
source to share
In the above code, you will be charged for one message each time the Receive call returns (even if the result is zero). The default receive call timeout is 60 seconds, so if there is no message for 5 hours, your code will return every minute and then hibernate for 25 seconds, so assume you get 48 messages per hour ( 1 minute timeout and 25 seconds wait). You can cause a Get overload that requires a timeout and go through a 5 hour timeout. Here the connection will be maintained for 5 hours before it comes back and thus there will be no fees during this time.
Per envelope: one receiver running with a one minute timeout without waiting, and no real messages get the message every minute. That's less than 5 cents for the entire month. See Calculation Calculator here
source to share
Only the message transaction (send, receive) will count ... Azure does not charge for KeepAlive messages ...
Refer to MSDN thread: http://msdn.microsoft.com/en-us/library/hh667438.aspx#BKMK_SBv2FAQ2_1
source to share