What is a Transactional Log Trailing in Microservices
In this tutorial, we are going to learn about Transactional Log Trailing in Microservices.
Transactional Log Trailing in Microservices
- Transactional log tailing is a pattern for reading events and messages from the outbox table.
Not every database provides their transactional log data. Only databases that have transactions support the transaction logs.
- For example, No SQL databases don’t have such features. But SQL Server has transaction logs.
- So in this pattern, the Message Relay Service reads their transaction logs to understand when a record is actually committed.
- It is guaranteed to be accurate because you are actually reading the logs of the database.
Requires database specific solutions, i.e., specific SQL server.
- For example, the solution you build to read the transaction logs in SQL cannot be used with the PostgreSQL.
To understand how this works. Let’s look at the below image, where we have order service that inserts into the Outbox table. When the Outbox Table is updated, the database also updates the transaction lock.
- Now the transaction log miner which is similar to the message relay service, reads the transaction log instead of directly reading the outbox table because the transaction log is very reliable.
- It reads that record and pushes it to their message broker.