NOTE

2.12 RocketMQ Transaction Messages

1. What Are RocketMQ Transaction Messages - Traditional local message tables depend on a message table in the database. - RocketMQ transactions encapsulate the local-message-table approach by moving the local message table into MQ, solving the atomicity problem between Producer-side message sending and local transaction execution.

Distributed Systems1 min readhistorical

This is a historical learning note and may contain outdated or incomplete understanding.

1. What Are RocketMQ Transaction Messages?

  • Traditional local message tables depend on a message table in the database.
  • RocketMQ transactions encapsulate the local-message-table approach by moving the local message table into MQ, solving the atomicity problem between Producer-side message sending and local transaction execution.

2. How RocketMQ Transaction Messages Work

  1. Service A sends a half message to MQ.
  2. Service A receives MQ’s confirmation for the half message.
  3. Service A executes the local transaction.
  4. Service A sends a commit/rollback message to MQ according to the execution result of the local transaction.
  5. If the confirmation message in step 2 is lost, or execution of the local transaction in step 3 times out, MQ sends the half-message confirmation to Service A again.
  6. Service A checks the local transaction status.
  7. Service A sends a commit/rollback message to MQ according to the local transaction status.
  8. After MQ receives a commit message, it sends the message to Service B. If it receives a rollback message, it discards the message.

3. References

Discussion

Sign in with GitHub to comment. Discussions are stored as GitHub Issues.View on GitHub