如何控制 nServicebus 中的消息丢失
我有一个 nServicebus 应用程序,现在我的应用程序从处理程序读取消息并自动从总线中删除消息。但我想要的是,从处理程序检索消息后,它不应该从总线中删除消息。在我的代码完成消息处理后,我将从总线中删除消息。这意味着我必须控制消息。
提前感谢
苏珊塔·萨曼塔
I have a nServicebus application,now my application reads messages from handler and remove the messages from bus automatically. But what I want is that after retriving messages from Handler it should not remove messages from bus.And after my message processing which is done by my code, I will remove the message from bus. It means I have to control the messages.
Thank in advance
Susanta Samanta
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
NServiceBus 在 TransactionScope 中运行所有处理程序,这意味着如果您的代码引发异常,消息将被放回队列中并稍后重试。因此,您不必担心捕获任何异常/管理如何从队列中删除消息,NSB 会为您处理这些问题。
如果您可以提供有关您正在尝试做的事情的更多信息,我也许可以为您提供更多帮助?
NServiceBus runs all handlers in a TransactionScope, that means that if your code throws an exception the message will be put back in the queue and retried later. So you shouldn't worry about catching any exceptions/managing how messages get removed from the queue, NSB takes care of that for you.
If you can provide some more info on what you're trying to do I might be able to help you some more?