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

发布于 2025-01-17 22:19:16 字数 549 浏览 6 评论 0原文

[希望这可以节省某个时间。]

下面的代码在搬到新的 queueclient class(在azure.storage.queque)中,来自defecreated

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

消息被移至相关的毒药队列队列中,而我在Azure的Application Insinsight中看不到任何错误消息。

当我手动将Azure Storage Explorer中的消息从毒药的消息队列回到队列中时,它起作用了!

[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):

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.

When I manually move the message in Azure Storage Explorer from the poison message queue back into the queue, it works!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

悸初 2025-01-24 22:19:16

< code>CloudQueue 类在之前的 v11 库中默认使用 base64 编码,而 QueueClient 不!

要设置 base64 编码,请添加 QueueClientOptions

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

The CloudQueue class defaulted to using base64 encoding in the prior v11 library, whereas QueueClient does not!

To set base64 encoding, add a QueueClientOptions:

QueueClientOptions queueOptions = 
    new() { MessageEncoding = QueueMessageEncoding.Base64 };
QueueClient queue = 
    new QueueClient(accountConnectionString, "myQueuename", queueOptions);
queue.Create();
queue.SendMessage(msg);
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文