NServiceBus如何处理事务?
如果处理失败,NServiceBus 是否会自动尝试重新传递消息?如果可以,尝试交付的次数是否有限制?
Does NServiceBus automatically attempt to redeliver messages if handling fails? And if it does, is there a limit in the number of times delivery can be attempted?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
NSB 将加入分布式事务,如果失败,它将重试配置的次数。查看 MsmqTransport 配置部分。
编辑:一旦您查看或收到来自 MSMQ 的消息,分布式事务就会开始。您在消息处理程序中所做的所有工作都将包含在事务中,并且由分布式事务协调器管理。如果您要更新数据库等,DTC 还将包括数据库事务之类的内容。
如果数据库更新失败,整个过程将回滚,消息将放回到队列中。
NSB will enlist in a distributed transaction and if it fails it will retry the configured number of times. Look at the MsmqTransport config section.
EDIT: A distributed transaction begins as soon as you peek or receive a message from MSMQ. All of the work you do in a message handler will be included in the transaction and it is governed by the Distributed Transaction Coordinator. The DTC will also include things like DB transactions if you are updating DBs and so on.
If say a DB update fails, the whole thing rolls back and the message is put back on the queue.