NOTE
2.12 RocketMQ Transaction Messages
RocketMQ transactional messages encapsulate the local-message-table approach in the message queue to coordinate message sending with local transaction execution.
This is a historical learning note and may contain outdated or incomplete understanding.
1. What Are RocketMQ Transactional 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 message sending on the producer side and local transaction execution.
2. How RocketMQ Transactional Messages Work

- Service A sends a half message to MQ.
- Service A receives MQ’s confirmation for the half message.
- Service A executes the local transaction.
- Service A sends a commit/rollback message to MQ based on the result of the local transaction.
- 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.
- Service A checks the local transaction status.
- Service A sends a commit/rollback message to MQ based on the local transaction status.
- 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
Drag to pan, scroll to zoom, and click a node to expand or collapse it. Large maps start with deeper levels collapsed; click nodes to expand them.
Discussion
Sign in with GitHub to comment. Discussions are stored as GitHub Issues.View on GitHub