下面的代码可以很好地读取服务总线队列死信,但对于主题,即使在更改路径后,它抛出的异常路径也不正确。string path= "QueueName";MessagingFactory messageFactory = MessagingFactory.CreateFromConnectionString("ConnecitonString");MessageReceiver deadletterReceiver = await messageFactory.CreateMessageReceiverAsync(QueueClient.FormatDeadLetterPath(path), ReceiveMode.PeekLock);MessageSender sender = await messageFactory.CreateMessageSenderAsync(path);BrokeredMessage deadLetter = await deadletterReceiver.ReceiveAsync(TimeSpan.Zero);if (deadLetter != null){现在我想对服务总线主题死信做同样的事情所以路径应该是 -topicName/subscriptionName string path= "TopicName/SubscriptionName"; MessagingFactory messageFactory = MessagingFactory.CreateFromConnectionString("ConnecitonString"); MessageReceiver deadletterReceiver = await messageFactory.CreateMessageReceiverAsync(TopicClient.FormatDeadLetterPath(path), ReceiveMode.PeekLock); MessageSender sender = await messageFactory.CreateMessageSenderAsync(path); BrokeredMessage deadLetter = await deadletterReceiver.ReceiveAsync(TimeSpan.Zero); if (deadLetter != null) {获取异常路径不正确...
1 回答
慕后森
TA贡献1802条经验 获得超5个赞
主题没有死信队列,但订阅有。您需要使用SubscriptionClient.FormatDeadLetterPath(String, String)方法,传递主题和订阅名称。
- 1 回答
- 0 关注
- 80 浏览
添加回答
举报
0/150
提交
取消