QueueClient.BeginReceive成本

时间:2013-05-03 21:15:49

标签: c# azure servicebus

根据this,我可以为QueueClient.BeginReceive 设置一个长达24天的时间段。 众所周知,azure服务总线的价格是存储交易。我想知道我是否为beginreceive方法设置了10天的超时时间,计算了多少个事务? 1?如果它不是1,我怎么能确定它?

这是一个来自我的工作角色的小代码示例。它的价格如何?

public override void Run()
{
    updaterClient.BeginReceive(TimeSpan.FromDays(1), updaterClientReceiveEnded, null);
    loggingQueueClient.BeginReceiveBatch(100, TimeSpan.FromMinutes(1), LoggingQueueClientReceiveEnded, null);

    while (!IsStopped)
    {
        Thread.Sleep(TimeSpan.FromMinutes(1));
    }
}

private async void updaterClientReceiveEnded(IAsyncResult ar)
{
    var brokeredMessage = updaterClient.EndReceive(ar);
    if (brokeredMessage != null)
    {
        var task = Task.Run(() => Updater.Current.Update(brokeredMessage));
        await task;
    }
    updaterClient.BeginReceive(TimeSpan.FromDays(1), updaterClientReceiveEnded, null);

}

private async void LoggingQueueClientReceiveEnded(IAsyncResult ar)
{
    var brokeredMessages = loggingQueueClient.EndReceiveBatch(ar);
    if (brokeredMessages != null)
    {
        var task = Task.Run(() => LogUtil.Current.HandleMessages(brokeredMessages.ToList()));
        await task;
    }
    loggingQueueClient.BeginReceiveBatch(100, TimeSpan.FromMinutes(1), LoggingQueueClientReceiveEnded, null);

}

1 个答案:

答案 0 :(得分:1)

每封邮件都收取费用(每10000封邮件收费0.01美元),因此,如果操作产生了一封邮件,则无论花费多长时间,都会收取相应的费用。

有关详细信息,请参阅http://msdn.microsoft.com/en-us/library/windowsazure/hh667438.aspx#BKMK_SBv2FAQ2_2