我有webjob队列触发器,这是响应队列消息,它工作得很好。然而,有时我们在队列中手动推送消息,如果存在手动错误,则会导致DecoderFallBackException。但奇怪的行为是,看起来webjob一直在尝试无限次,而我们的AI日志正在制造混乱。我尝试重新启动webjob,看看它是否清除了任何内部缓存,但没有帮助。唯一有帮助的是删除队列
理想情况下,任何超过双队列计数的异常都应该将消息移动到有毒队列。
发布于 2019-09-25 14:42:45
我试着在我这边重现你的问题,但效果很好。首先,我创建了一个后端演示,用于在队列中插入可能导致DecoderFallBackException的无效字节消息
Encoding ae = Encoding.GetEncoding(
"us-ascii",
new EncoderExceptionFallback(),
new DecoderExceptionFallback());
string inputString = "XYZ";
byte[] encodedBytes = new byte[ae.GetByteCount(inputString)];
ae.GetBytes(inputString, 0, inputString.Length,
encodedBytes, 0);
//make the byte invalid
encodedBytes[0] = 0xFF;
encodedBytes[2] = 0xFF;
CloudQueueMessage message = new CloudQueueMessage(encodedBytes);
queue.AddMessage(message);Web作业代码:
public static void ProcessQueueMessage([QueueTrigger("queue")] string message, TextWriter log)
{
log.WriteLine(message);
}在异常发生5次后,消息被移到“queue-poison”。这是预期的行为。有关详细信息,请查看here:
maxDequeueCount 5 The number of times to try processing a message before moving it to the poison queue.您可以检查是否意外地将"maxDequeueCount“设置为更大的值。如果没有,请提供您的网络作业代码,以及您如何找到DecoderFallBackException以供我们调查。
https://stackoverflow.com/questions/57961792
复制相似问题