如何在 NServiceBus 中正确池化多个消息?

发布于 2024-08-16 11:49:21 字数 119 浏览 1 评论 0原文

我有一个 NServiceBus 应用程序,当需要大型数据库更新时,它会收到特定消息。在进行此更新时,我想以某种方式忽略此类类型的所有传入消息。最好的方法是什么?我应该在其中添加 lock 语句吗?

I have an NServiceBus app which receives a particular message when a large database update is required. While this update is happening, I want to either somehow ignore all incoming messages of this type. What is the best way of doing it? Should I put a lock statement in there?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

情场扛把子 2024-08-23 11:49:21

在 NServiceBus (App.config) 的配置中,您可以设置 NumberOfWorkerThreads,如果将其设置为 1,则一次只会处理一条消息。

然后,如果您将停止处理此消息的时间保留在内存中。您可以删除这两个时间之间到达的所有邮件。

但正如 Udi 可能会说的那样,不要尝试从技术上解决问题,而是从业务角度寻找解决方案。

In the config of NServiceBus (App.config) you can set the NumberOfWorkerThreads, if you set this to 1 only one message at a time will be processed.

Then if you keep the time you stopped processing this message in memory. You can drop all messages that have arrived between these two times.

But as Udi probably would say, don't try to solve it technically but find a solution from the business perspective.

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