You have applied the [[Transactional Outbox]] pattern.
Tail the database transaction log and publish each message/event inserted into the outbox to the message broker.
The mechanism for trailing the transaction log depends on the database:
MySQL binlog
Postgres WAL
AWS DynamoDB table streams
Eventuate Tram frameworkarrow-up-right implements transaction log tailing.
This pattern has the following benefits:
No 2PC
Guaranteed to be accurate
This pattern has the following drawbacks:
Relatively obscure although becoming increasing common
Requires database specific solutions
Tricky to avoid duplicate publishing
The [[Transactional Outbox]] pattern creates the need for this pattern
The [[Polling publisher]] pattern is an alternative solution
My book Microservices patternsarrow-up-right describes this pattern in a lot more detail.
The Eventuate Tram frameworkarrow-up-right implements this pattern
Last updated 3 years ago