The problems we solve
-
Events lost when a service crashes between the database write and publishing the event.
-
The same message processed twice: stock reserved twice, an email sent twice.
-
A RabbitMQ topology that grows with every new use case.
-
Message contracts that break in production even though the tests passed.
-
User interfaces that poll the server over and over to see a change.
What we put in place
-
A simple topology: one exchange, one queue per consuming service.
-
The outbox pattern on the producer side, idempotency on the consumer side.
-
Versioned contracts: JSON Schema, DTOs and regression tests.
-
Explicit error handling: retry, dead letter queue, replay.
-
Real-time updates to the user interfaces with Mercure.
-
A reasoned choice of broker: RabbitMQ, Kafka, or both.
Articles
Idempotent consumer with Symfony Messenger: the processed_event table
The same event can arrive twice. A processed_event table, written in the same transaction as the effect, discards the duplicate with Symfony Messenger.
Updated on Oct 02, 202611 min read
Message contracts in a monorepo: JSON Schema and DTOs
In a monorepo, a message change passes the tests, then breaks in production. A shared contracts package, additive changes and frozen fixtures prevent it.
Updated on Oct 02, 202611 min read
Splitting an event-driven architecture: six axes to decide
Data ownership, messages, transport, push to the fronts, shared code, transactions: the six axes of an event-driven architecture, a services map and procedures.
Updated on Oct 02, 202611 min read
The Outbox pattern with Symfony Messenger: publish without losing events
Writing to the database then publishing can lose an event. The outbox writes it in the same transaction, a relay publishes it: Messenger, Doctrine, PostgreSQL.
Updated on Oct 02, 202611 min read
RabbitMQ: one topic exchange and one queue per consuming service
Several services react to the same event? A single topic exchange, one queue per consuming service and versioned routing keys, with Symfony Messenger.
Updated on Oct 01, 20269 min read