A practical guide to the transactional outbox pattern in Go. Write to your database and publish events atomically in a single transaction, then stream those events to Kafka with Debezium and change data capture.
Prerequisites
What do you need to follow along?
Working knowledge of Golang.
Go & Docker installed on your PC.
Basic knowledge of Kafka. If you need a refresher, my guide on fault-tolerant Kafka pipelines covers the basics.
Basic knowledge of the saga pattern. My guide on the saga pattern in Golang covers everything you need.
Patience. I tried to keep this guide short. I failed.
The Problem
We have an e-commerce platform built with microservices, and we use the saga pattern to coordinate transactions across services. When a customer places an order, our order service receives and validates it.β¦