“IsTransactional”是什么意思? NServiceBus 是什么意思?
我正在创建一个 Web 应用程序,它将使用 NServiceBus 发送消息,并写入数据库。我希望这是一个原子操作,即事务,因此我将代码包装在 using new TransactionScope() 语句中。
配置 NServiceBus 时,您可以调用 IsTransactional 方法。什么时候将“false”传递给此方法,什么时候“true”合适?
I am creating a web application that is going to send messages using NServiceBus, and also write to a database. I want this to be an atomic operation, i.e. a transaction, so I wrap the code in a using new TransactionScope() statement.
When configuring NServiceBus you can call the IsTransactional-method. When do I pass 'false' to this method, and when is 'true' appropriate?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
IsTransactional(true) 意味着所有传入消息都将在事务范围
http: //docs.pspecial.net/nservicebus/architecture/
http://docs.prefer.net/nservicebus/architecture/principles
对于发送(传出消息)您需要创建自己的事务范围以确保与数据库一致。通常,将实际处理(例如写入数据库)移至后端进程是一个好主意。如果您这样做,NServiceBus 将为您处理重试、异常管理等事务。
有关更多信息,请参见:
http://www.make-awesome.com/2010/10/why-not-publish-nservicebus-messages-from-a-web-application/
IsTransactional(true) mean that all incoming messages will be processed within a transactionscope
http://docs.particular.net/nservicebus/architecture/
http://docs.particular.net/nservicebus/architecture/principles
For sends (outgoing messages) you need to create your own transaction scope to make sure that you're consitent with your database. Usually it's a good idea to move the actual processing (like writing to the database) to backend processes. If you do that NServiceBus will handle things like retries, exception management etc for you.
More about that here:
http://www.make-awesome.com/2010/10/why-not-publish-nservicebus-messages-from-a-web-application/