Skip to catalogue

118

pub/sub

Publishers do not know the subscribers. Each subscriber gets the event. A work queue is the opposite: one consumer does the job.

What is pub/sub?

Publish/subscribe fans a message out to every interested subscriber. A queue hands a job to one worker. Mixing them up means either every worker sends the email, or nobody hears the event they needed.

Why does pub/sub matter when vibe coding?

Models use one “bus” for both. Two email workers both send. Or a cache invalidation only reaches one of five app nodes. Say fan-out versus competing consumers.

How do you do pub/sub?

Events that notify: pub/sub, every instance subscribed. Jobs that must happen once: a queue. Do not share one topic for both without a rule.

How do you ask a model for pub/sub?

Use pub/sub for (event) so every instance receives it. Use a queue for (job) so exactly one worker runs it. Do not use one channel for both.

What goes wrong with pub/sub?

Pub/sub with no retention and a subscriber that was restarting. It missed the event. If missing one is unacceptable, you needed a log or a queue, not a live fan-out.

adjacent