gpt4 book ai didi

azure - 如何访问 Azure 订阅上的死信子队列?

转载 作者:行者123 更新时间:2023-12-03 22:51:12 24 4
gpt4 key购买 nike

当我使用以下内容时:

var deadLetterPath = SubscriptionClient.FormatDeadLetterPath(topicPath,subName);
var client = SubscriptionClient.CreateFromConnectionString(connectionString, deadLetterPath, subName);

我收到 InvalidOperationException

Cannot directly create a client on a sub-queue. Create a client on the main queue and use that to create receivers on the appropriate sub-queue

azure 文档的某些部分说使用 SubscriptionClient.CreateReceiver 来访问子队列,但该方法不存在。

最佳答案

这种方法对您有用吗?

MessagingFactory factory = MessagingFactory.CreateFromConnectionString(cnxString);
var deadLetterPath = SubscriptionClient.FormatDeadLetterPath(topicPath,subName);
var dlqReceiver = factory.CreateMessageReceiver(deadLetterPath, ReceiveMode.ReceiveAndDelete);

我还没有在这里(在 session 中)测试过它,但请尝试一下

干杯

关于azure - 如何访问 Azure 订阅上的死信子队列?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22681954/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com