Event sourcing lưu mọi thay đổi state dưới dạng immutable event thay vì lưu state hiện tại.
RabbitMQ phù hợp tự nhiên:
- event publish lên RabbitMQ streams khi xảy ra,
- consumer subscribe để cập nhật read model/cache,
- replay event để rebuild state sau failure hoặc audit
RabbitMQ Streams cung cấp durable, replayable event log tương tự event store.
RabbitMQ không thay thế dedicated event store (EventStoreDB, PostgreSQL) nhưng bổ sung tốt vai trò event bus trong toàn hệ thống.
Event sourcing persists state changes as immutable events.
- RabbitMQ fits naturally: events are published to streams as they occur, consumers subscribe to update read models, and streams support replay to rebuild state for audit or failure recovery.
- RabbitMQ Streams provide durable, replayable event logs similar to event stores.
- RabbitMQ complements but doesn't replace dedicated event stores like EventStoreDB.