[英]Messages in Azure Message Queue are going Straight to the Poison Message Queue
[Hoping this might save someone some time.] [希望这可以节省一些时间。]
The code below stopped working when moving to the newer QueueClient
class (in Azure.Storage.Queues) from the deprecated CloudQueue
class (in Microsoft.Azure.Storage.Queue):当从已弃用的
CloudQueue
class(在 Microsoft.Azure.Storage.Queue 中)移动到较新的QueueClient
class(在 Azure.Storage.Queues 中)时,以下代码停止工作:
QueueClient queue = new QueueClient(accountConnectionString, "myQueuename");
queue.Create();
queue.SendMessage(msg);
Messages are being moved into the associated poison message queue, and I don't see any error messages in Azure's ApplicationInsights.消息被移入关联的有害消息队列,我在 Azure 的 ApplicationInsights 中没有看到任何错误消息。
When I manually move the message in Azure Storage Explorer from the poison message queue back into the queue, it works!当我手动将 Azure 存储资源管理器中的消息从毒消息队列移回队列时,它起作用了!
The CloudQueue
class defaulted to using base64
encoding in the prior v11 library, whereas QueueClient
does not! CloudQueue
class 在之前的 v11 库中默认使用base64
编码,而QueueClient
没有!
To set base64
encoding, add a QueueClientOptions
:要设置
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.