Share the work or share the news?
How delivering queued work to competing consumers differs from distributing notifications to subscribers, including when each subscriber needs its own queue. · associate
A work queue divides work among competing consumers. Several workers read from the same queue, but each message is intended to be processed by one worker, not by every worker. Amazon SQS provides this queued-work pattern.
Publish-subscribe messaging distributes a published message to matching subscriptions. This is fan-out: billing and analytics can each receive an independent copy of the same order event. Amazon SNS provides topics for this distribution.
The distinction is the intended recipients, not an exactly-once guarantee. A queued message can be delivered again, so workers should tolerate duplicates. Choose a shared queue when workers perform the same job; choose fan-out when different recipients each need the event.
| Delivery choice | Shared work queue | Publish-subscribe topic |
|---|---|---|
| Purpose | Divide processing work | Distribute notifications |
| Recipients | One intended worker per message | Each matching subscription |
| Adding a recipient | Adds processing capacity | Adds an independent destination |
| AWS service | Amazon SQS | Amazon SNS |
AWS architecture icons are the property of Amazon Web Services. BlowStack is not affiliated with or endorsed by AWS.