如何控制 nServicebus 中的消息丢失

发布于 2024-08-17 05:30:25 字数 154 浏览 1 评论 0原文

我有一个 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

明月松间行 2024-08-24 05:30:25

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?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文