Monolith applications use the 2 phase commit protocol.
● It splits the commit process of the transaction into 2 steps and ensures the ACID principles for all systems.
● Can't use 2-phase commit transactions when building microservices.
● These transactions require locks and don’t scale well.
● Need all systems to be up and running at the same time. Solutions
● Transactional Outbox Pattern
● CDC - Change Data Capture
Best Practice
● Use Red Hat Apache Kafka and CDC using Debezium in eventdriven applications.
● Use New databases like CockroachDB which has built-in
Change Data Capture feature
https://www.cockroachlabs.com/blog/message-queuing-database-kafka/