5

疑问:事务消息和事务中提交消息的差异

 3 years ago
source link: https://www.v2ex.com/t/779670
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

V2EX  ›  程序员

疑问:事务消息和事务中提交消息的差异

  SilenceLL · 5 小时 7 分钟前 · 220 次点击

请教一下,基于 MQ 的事务消息比如 RocketMQ 的事务消息和在事务中投递消息,如果投递消息失败则回滚的差异在哪里了。

新手上路,多多包涵。

2 条回复    2021-05-28 00:58:55 +08:00

zhgg0

zhgg0   4 小时 9 分钟前   ❤️ 1

在事务中投递消息,如果投递成功,接下来的事务失败咋回滚消息?

yeqizhang

yeqizhang   2 小时 2 分钟前 via Android

无论如何都是要等本地事务执行成功后再尝试提交消息(事务消息在本地事务执行前只是半提交),如果提交消息的代码穿插在本地事务中间,就会出现一楼说的消息提交后本地事务又失败了怎么办。提交消息成功没有回滚这个说法,事务消息那个回滚是因为消息中间间支持了半提交的消息。

如果你用普通消息,本地事务执行完后最后发送消息失败,需要重试发送,或者对已经执行成功的本地事务进行处理。事务消息那是另外一种做法

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK