Pub/sub pattern broadcast cùng một message đến nhiều consumer độc lập: producer gửi lên fanout hoặc topic exchange, nhiều queue bind vào đó, mỗi queue gửi bản sao của mình đến consumer riêng.
- Khác work queue — pub/sub nhân bản message, không chia.
- Dùng cho: hệ thống notification (gửi email, SMS, push notification độc lập nhau), phân phối event, đồng bộ dữ liệu.
- Scale bằng cách thêm queue và consumer mới mà không cần sửa producer.
Pub/sub broadcasts the same message to multiple independent consumers: producer publishes to a fanout/topic exchange, multiple queues bind to it, each queue delivers its copy to its consumer(s).
- Unlike work queues where only one consumer gets each message, pub/sub duplicates.
- Use for notification systems, event distribution, data sync.
- Scale by adding queues and consumers without changing the producer.