每条消息的 NServiceBus IMessageModule

发布于 2024-12-03 10:35:54 字数 128 浏览 2 评论 0原文

我必须根据 Message 中的属性从多个 SessionFactory 构造 NHibernate Session,我想我可以使用 IMessageModule 来处理消息处理的开始,但它没有任何参数,我不知道是否可以访问当前消息正在处理。

I have to construct NHibernate Session from multiple SessionFactory based on a property inside Message, I think I could use IMessageModule to handle the begin of message processing but it doesn't have any argument and I don't know if it's possible to access current message being handled.

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

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

发布评论

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

评论(1

兲鉂ぱ嘚淚 2024-12-10 10:35:54

您可以使用静态 Bus.CurrentMessageContext.Headers 属性访问标头

更多信息:

https://github.com/NServiceBus/NServiceBus/blob/v2.5/Samples/FullDuplex/MyClient/ClientEndpoint.cs

You can access the headers using the static Bus.CurrentMessageContext.Headers property

More here:

https://github.com/NServiceBus/NServiceBus/blob/v2.5/Samples/FullDuplex/MyClient/ClientEndpoint.cs

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