NServiceBus / NHibernate 是否需要 MSDTC?
我正在编写 NServiceBus 解决方案并尝试使用 DBSubcriptionStorage。这使用 NHibernate 进行数据访问,我得到以下异常:
合作伙伴事务管理器已禁用对远程/网络事务的支持
我可以启用 MSDTC,但我的问题是:此要求从何而来,我可以删除它吗?
我对 NHibernate 不熟悉,我不知道它是否需要 MSDTC 或者 NServiceBus 是否需要。 NServiceBus 订阅数据库中只有一张平面表,我几乎看不到 MSDTC 在这种情况下的使用。
我可以删除 MSDTC 要求吗?我是否必须为此目的编写自己的订阅持久层?
谢谢
I am writing an NServiceBus solution and trying to use DBSubcriptionStorage. This uses NHibernate for data access and I get the following exception:
The partner transaction manager has disabled its support for remote/network transactions
I could enable MSDTC but my question is: where is this requirement coming from and can I remove it?
I am not familiar with NHibernate and I don't know if it requires MSDTC or if NServiceBus does. There is only one flat table in the NServiceBus subscription database and I can hardly see the use of MSDTC in this scenario.
Can I remove the MSDTC requirement? Will I have to write my own subscription persistence layer for that purpose?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
MSDTC 是一种很棒的小动物,但也可能非常阴险。
首先,如果您知道自己不想成为分布式事务的一部分,我建议您在开发服务器上将其关闭。您不希望在 DEV 中自动升级为分布式事务,却发现它会影响您的实际性能或在生产中不起作用。
话虽这么说,答案是像 NHibernate 这样的 ORM 不会这样做,但如果满足以下条件之一,则很可能让 MSDTC 参与进来:
如果满足这些条件中的任何一个(当然还有其他一些我忘记了),您的事务将自动升级为分布式事务,并且 MSDTC 必然会参与其中。这意味着 MSDTC 不仅必须为您的盒子工作和配置,还必须为所有想要参与您的交易的盒子进行配置。在简单的 SQL Serve 场景中,这意味着您的应用程序服务器和 SQL Server 都需要运行它并针对分布式事务进行配置。
我不熟悉 NServiceBus,但我倾向于认为它具有各种功能,可以以事务方式将消息放置在队列上。
MSDTC is a great little animal, but can be quite insidious.
First off, I recommend that if you know you don't ever want to be a part of a distributed transaction, that you turn it OFF on your development servers. You don't want to automatically promote to a distributed transaction in DEV only to find out that it kills your real-world performance or doesn't work in production.
That being said, the answer is that ORMs like NHibernate do not, but it's very possible to get MSDTC involved if one of these conditions are met:
If any of these conditions are met (surely there are some others I've forgotten about), your transaction will auto-promote to a distributed transaction, and MSDTC necessarily gets involved. That means that not only does MSDTC have to be working and configured for your box, it has to be configured for all boxes that want to participate in your transaction. In a simple SQL Serve scenario, that means your app server and your SQL Server both need to have it running and configured for distributed transactions.
I'm not familiar with NServiceBus, but I'd tend to think it would have all kinds of functionality which would transactionally place messages on, say, a queue.