NOTE
2.8 Reliable-Message Eventual-Consistency Implementation: Local Message Table
Using points awarded after an order as an example, the service creates the order and writes a message within a local transaction, then uses messaging to drive the points service.
This is a historical learning note and may contain outdated or incomplete understanding.
1. What Is a Local Message Table?

Consider two transactions: placing an order and then awarding points.
Service A handles orders, and Service B handles points.
- Service A executes ordering logic.
begin transaction;
1. place order
2. insert log into local message table
commit transaction;
- After Service A successfully places the order, it sends a message to MQ.
- Service B consumes the message and processes its local transaction.
begin transaction;
1. insert message into local message table
2. add points
commit transaction;
- After Service B executes successfully, update the status in the local message table.
- Service B message-table status [ZooKeeper can be used for decoupling].
- Service A periodically scans the message table and sends unprocessed messages to MQ.
2. Characteristics
This approach depends on MQ and a database. The initiator can implement a scheduled task to poll for failed messages and resend them.
2PC vs Local Message Table
The local message table introduces MQ and executes distributed transactions asynchronously, improving throughput.
Local Message Table Implementation
RocketMQ Transaction Messages
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