Azure 存储队列客户端不会将消息放入毒物队列
Azure Storage Queue Client does not put message in poison queue
这是一个新手问题。
我有一个使用存储队列的计时器触发器 (Client.Azure.Storage.Queues)
客户端是否自动将未处理的消息发送到病毒队列?此代码模拟错误。如果一切正常,则消息将被删除。
public async Task Run([TimerTrigger("%TimerExpression%")]TimerInfo myTimer, ILogger log)
{
log.LogInformation($"C# Timer trigger function executed at: {DateTime.Now}");
QueueMessage[] messages = await _queueClient.ReceiveMessagesAsync(maxMessages: 10, null );
try
{
foreach (QueueMessage message in messages)
{
Console.WriteLine(message.DequeueCount + "-------------------");
Console.WriteLine (message.Body)=
_queueClient.(message);
throw new ApplicationException("HELP");
_queueClient.DeleteMessage(message.MessageId, message.PopReceipt);
}
}
catch(Exception e)
{
Console.WriteLine(e.Message);
}
}
我希望消息在重试 2 次后不会返回到队列中:
{
"version": "2.0",
"logging": {
"applicationInsights": {
"samplingSettings": {
"isEnabled": true,
"excludedTypes": "Request"
}
}
},
"extensions": {
"queues": {
"retry": {
"strategy": "fixedDelay",
"maxRetryCount": 2,
"delayInterval": "00:00:03"
}
}
}
}
还是我遗漏了什么?还是我必须手动将邮件添加到毒队列?
问候
斯特凡
Does the client automatically send not processed messages to the poison queue?
不,不是。
但是,Azure Functions 队列触发器将。如果您从队列而不是计时器触发您的函数,那么您最终会收到有毒队列消息。
如果您直接使用存储客户端而不是触发队列,那么您需要自己处理有害队列。
这是一个新手问题。
我有一个使用存储队列的计时器触发器 (Client.Azure.Storage.Queues)
客户端是否自动将未处理的消息发送到病毒队列?此代码模拟错误。如果一切正常,则消息将被删除。
public async Task Run([TimerTrigger("%TimerExpression%")]TimerInfo myTimer, ILogger log)
{
log.LogInformation($"C# Timer trigger function executed at: {DateTime.Now}");
QueueMessage[] messages = await _queueClient.ReceiveMessagesAsync(maxMessages: 10, null );
try
{
foreach (QueueMessage message in messages)
{
Console.WriteLine(message.DequeueCount + "-------------------");
Console.WriteLine (message.Body)=
_queueClient.(message);
throw new ApplicationException("HELP");
_queueClient.DeleteMessage(message.MessageId, message.PopReceipt);
}
}
catch(Exception e)
{
Console.WriteLine(e.Message);
}
}
我希望消息在重试 2 次后不会返回到队列中:
{
"version": "2.0",
"logging": {
"applicationInsights": {
"samplingSettings": {
"isEnabled": true,
"excludedTypes": "Request"
}
}
},
"extensions": {
"queues": {
"retry": {
"strategy": "fixedDelay",
"maxRetryCount": 2,
"delayInterval": "00:00:03"
}
}
}
}
还是我遗漏了什么?还是我必须手动将邮件添加到毒队列?
问候 斯特凡
Does the client automatically send not processed messages to the poison queue?
不,不是。
但是,Azure Functions 队列触发器将。如果您从队列而不是计时器触发您的函数,那么您最终会收到有毒队列消息。
如果您直接使用存储客户端而不是触发队列,那么您需要自己处理有害队列。