NServiceBus:如何以编程方式连接 IHandleEvents

发布于 2024-09-13 05:39:17 字数 184 浏览 2 评论 0原文

对于我的订阅者 MT 之一,我需要有多个 IHandleEvents 实现,并允许第 3 方指定他们自己的实现。在应用程序启动时,我希望能够扫描目录和配置以确定要使用的实现,然后将其注册以用于所有传入消息。这可能吗?我会以某种方式注册该类型吗?或者我会注册一个实例吗?或者也许是一个 Func,以便我可以在 func 中决定是每次提供新实例还是重复使用?

For one of my Subscriber MTs, I need to have multiple implementations of IHandleEvents, as well as allow 3rd parties to specify their own implementations. At application startup, I would like to be able to scan the directory and the config to determine which implementation to use, and then register it to be used for all incoming messages. Is this possible? Would I somehow register the type? Or would I register an instance? Or maybe a Func so that I could decide in the func whether to provide a new instance everytime or re-use?

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

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

发布评论

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

评论(1

勿忘初心 2024-09-20 05:39:17

我假设你的意思是 IHandleMessages- 如果您不希望 NServiceBus 扫描并注册它自动找到的类型,您可以使用Configure.With(types) 或Configure.With(assemblies) 来限制NServiceBus 将使用的类型。

I assume you mean IHandleMessages<T> - if you don't want NServiceBus to scan and register the types it finds automatically, you can use Configure.With(types) or Configure.With(assemblies) to limit the types NServiceBus will use.

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