很难找到一些关于将所有消息放在deadletter队列中并查看它们的好文档。我有一个Azure服务总线队列。我能找到的所有东西都是针对服务总线的话题...有人可以通过快速指南帮助我吗?如何查看deadletter消息
0
A
回答
3
死信队列是一个次要子队列,其中毒讯息被移动到。 对于azure服务总线队列,DLQ的标准路径是queuePath/$ DeadLetterQueue。 所以你需要有另一个queueclient来读取这个DLQ。
而你会在.net客户端中做这样的事情。
string connectionString = CloudConfigurationManager.GetSetting("Microsoft.ServiceBus.ConnectionString");
QueueClient Client = QueueClient.CreateFromConnectionString(connectionString, "QueueName");
// do whatever regular queue reading activities
// this is for dead letter queue
QueueClient deadLetterClient = QueueClient.CreateFromConnectionString(connectionString, QueueClient.FormatDeadLetterPath(Client.Path), ReceiveMode.ReceiveAndDelete);
BrokeredMessage receivedDeadLetterMessage;
while ((receivedDeadLetterMessage = deadLetterClient.Receive(TimeSpan.FromSeconds(10))) != null)
{
Console.WriteLine(receivedDeadLetterMessage);
}
0
string connectionString = ConfigurationManager.AppSettings["connectionString"];
string queueName = ConfigurationManager.AppSettings["queueName"];
ServiceBusConnectionStringBuilder builder = new ServiceBusConnectionStringBuilder(connectionString);
MessagingFactory factory = MessagingFactory.CreateFromConnectionString(builder.ToString());
var client = QueueClient.CreateFromConnectionString(connectionString, queueName);
string deadLetterQueuePath = QueueClient.FormatDeadLetterPath(queueName);
QueueClient deadletterQueueClient = factory.CreateQueueClient(deadLetterQueuePath);
while (true)
{
BrokeredMessage brokeredMessage = deadletterQueueClient.Receive();
// Your Logic
}
0
下面是如何在使用皮克死信队列得到的所有消息列表的例子:
public async Task<IEnumerable<BrokeredMessage>> GetDeadLetterMessagesAsync(string connectionString,
string queueName)
{
var queue = QueueClient.CreateFromConnectionString(connectionString, QueueClient.FormatDeadLetterPath(queueName));
var messageList = new List<BrokeredMessage>();
BrokeredMessage message;
do
{
message = await queue.PeekAsync();
if (message != null)
{
messageList.Add(message);
}
} while (message != null);
return messageList;
}
相关问题
- 1. 如何查看kafka消息
- 2. Tidy.NET - 如何查看错误消息?
- 3. 如何查看消息的语言ID?
- 4. 如何查看队列中的消息
- 5. VB6查看消息队列
- 6. 查看TeamCity服务消息
- 7. ASP.NET MVC查看消息
- 8. 当鼠标悬停在消息上时,如何查看实际消息?
- 9. 电报频道消息查看次数
- 10. iOS邮件消息查看像UIWebView
- 11. 在VS2010中查看调试消息
- 12. ThunderBird查看消息的事件
- 13. 查看消息的事件API文本
- 14. 无法通过php查看消息?
- 15. 在Windows 8.1中查看DbgPrint消息
- 16. MVVM ViewModel查看消息传送
- 17. ActionResult需要发送消息来查看
- 18. emacs psvn,如何查看svn-commit日志消息?
- 19. 如何查看Android中的日志消息?
- 20. 如何在Delphi的DBX事务中查看SQL错误消息?
- 21. 如何在android logcat中以xml格式查看xmpp消息?
- 22. 在Mathematica中,如何查看完整的消息输出?
- 23. 如何自动更改文本查看消息?
- 24. cocos2d,如何在android studio上查看日志消息?
- 25. 如何查看node.js中的警告和错误消息?
- 26. Azure服务总线 - 如何查看Azure门户中的消息
- 27. 如何查看odoo 9中的旧消息?
- 28. 如何在查看消息旁边创建收件箱
- 29. 如何在Apache中查看HTTP响应消息
- 30. 如何打开Gmail查看消息活动?
但是我真的不知道该topicPath是什么?既然这是一个队列而不是话题? –
对不起。我用队列客户端更新了代码。出于某种原因,我认为你要求主题和潜艇。 – Aravind
嗯,当涉及到while循环这个给我以下错误: 型“System.UnauthorizedAccessException的”未处理的异常在Microsoft.ServiceBus.dll发生 附加信息:虽然授权令牌无效签名, 感谢:40103 ! –