繁体   English   中英

Azure 消息队列中的消息直接进入中毒消息队列

[英]Messages in Azure Message Queue are going Straight to the Poison Message Queue

[希望这可以节省一些时间。]

当从已弃用的CloudQueue class(在 Microsoft.Azure.Storage.Queue 中)移动到较新的QueueClient class(在 Azure.Storage.Queues 中)时,以下代码停止工作:

QueueClient queue = new QueueClient(accountConnectionString, "myQueuename");
queue.Create();
queue.SendMessage(msg);

消息被移入关联的有害消息队列,我在 Azure 的 ApplicationInsights 中没有看到任何错误消息。

当我手动将 Azure 存储资源管理器中的消息从毒消息队列移回队列时,它起作用了!

CloudQueue class 在之前的 v11 库中默认使用base64编码,而QueueClient没有!

要设置base64编码,请添加QueueClientOptions

QueueClientOptions queueOptions = new() { MessageEncoding = QueueMessageEncoding.Base64 };
QueueClient queue = new QueueClient(accountConnectionString, "myQueuename", queueOptions);
queue.Create();
queue.SendMessage(msg);

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM