0

据此,我甚至可以为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);

}
4

1 回答 1

1

您需要为每条消息付费(以及每 10000 条消息 0.01 美元),因此,如果操作导致一条消息,那么无论花费多长时间,您都需要为此付费。

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

于 2013-05-04T01:38:00.557 回答