Outbox, Saga and Kafka in GoLately I've been preparing for a system design interview(In today’s market, maintaining your skills isn’t optional), and one of the topics that always comes up is "how do you build a reliable event-driven service". So I built a small project to actually do it, not just talk about it. Order pipeline, three Go services, Postgres, Kafka, Debezium, the whole thing in docker-compose. Took a weekend. This post is what I learned, mostly the patterns that I think are worth knowing if you ever touch Kafka from Go.The problem:You write an HTTP handler, it inserts an order into the database, then publishes an event to Kafka. Looks fine in code review. Then production happens.db.Insert(order) producer.Send(orderEvent) // network blip → event lostOr the other way around, Kafka publishes, the database rolls back, and now your inventory service is reserving stock for an order that doesn't exist. There is no way to make these two writes atomic without 2 phase commit(2PC),…
No comments yet. Log in to reply on the Fediverse. Comments will appear here.