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