Gwarancje dostarczenia, wzorce outbox i inbox
Twój kod zapisuje zamówienie w bazie, a potem publikuje wiadomość „zamówienie złożone”. Jeśli proces padnie między tymi krokami, zamówienie istnieje, ale nikt się o nim nie dowie. Ponowisz próbę, a ktoś może dowiedzieć się dwa razy. Zrozumiesz, co naprawdę obiecują gwarancje at-most-once, at-least-once i exactly-once i jak wzorzec outbox zamyka tę lukę, zapisując wiadomość w tej samej transakcji co dane.
Pierwszy artykuł wyjaśnia gwarancje oraz wzorce outbox i inbox. Trzy kolejne dotyczą budowania outboxa na PostgreSQL: subtelnego problemu z kolejnością przy sekwencjach i tego, jak wysyłać wiadomości zaraz po zapisaniu, zamiast ich odpytywać. Ostatni pokazuje na przykładzie PostgreSQL, MongoDB i Kafki, dlaczego nie da się mieć jednocześnie ścisłej kolejności i dużej przepustowości.
Zacznij od pierwszego. Artykuły o PostgreSQL zakładają, że go znasz.

Outbox, Inbox patterns and delivery guarantees explained
2020-12-30Yesterday I was asked by Cezary about the transactional outbox pattern sample implementation. My answer was: https://twitter.com/oskar_at_net/status/134418424710032998…
How Postgres sequences issues can impact your messaging guarantees
2022-10-28Big picture descriptions and overall explanations are great. They help us to understand the foundations of new ideas and then find the place we need to evaluate more…
Push-based Outbox Pattern with Postgres Logical Replication
2022-10-13There are only a few patterns that I’m comfortable saying: “You should use it always if you want to build mature system”. One of them is the Outbox Pattern. Why? Because…
How to get all messages through Postgres logical replication
2022-11-20In an earlier article, I described Push-based Outbox Pattern with Postgres Logical Replication. The idea is to store the outgoing message (e.g. event) in the same…
The Order of Things: Why You Can't Have Both Speed and Ordering in Distributed Systems
2025-07-14Picture this scenario: An online retailer runs a flash sale with 500 units of a hot product. Within minutes, they’ve processed 742 orders. Their inventory shows -24…