Comparison
Message queuevsPublish-subscribe
Message queue
you push the slow job onto a queue and return to the user immediately, and a worker picks it up whenever it can.
A buffer of work items consumed by workers, where each message is delivered to one consumer and removed once acknowledged. It decouples request latency from work duration and absorbs bursts. It also converts synchronous errors into invisible ones, so a queue without a dead letter path and depth alerting is a place for work to go and quietly die.
Full entry →Publish-subscribe
you publish the event once and three different services each get their own copy without the publisher knowing they exist.
A pattern where publishers emit to a topic and every interested subscriber receives a copy. It removes the publisher's knowledge of consumers, which is what makes adding a fourth consumer a zero-change operation upstream. The trade is that nobody owns the contract, so a field the publisher considers cosmetic can be load-bearing for a subscriber it has never heard of.
Full entry →