如何访问 Azure 订阅上的死信子队列? [英] How do you access the dead letter sub-queue on an Azure subscription?

查看:24
本文介绍了如何访问 Azure 订阅上的死信子队列?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我使用以下内容时:

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

我收到一个 InvalidOperationException

I get an 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 来访问子队列,但该方法不存在.

Some parts of the azure documentation say to use SubscriptionClient.CreateReceiver to access a sub-queue but that method doesn't exist.

推荐答案

这种方法对你有用吗?

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

我还没有在这里(在会议中)测试过,但可以尝试一下

I haven't test it out here (in a meeting), but give it a try

干杯

这篇关于如何访问 Azure 订阅上的死信子队列?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆