Skip to content
tezvyn:

Event bus versus message queue for triggers

Source: interviewMediumHow cards are made

Summary

messaging pattern selection.

Key points

a queue is point-to-point buffered work for one consumer group; an event bus routes and filters one event to many decoupled subscribers. Event bus wins when many independent services must react.

WHAT THIS TESTS This checks whether you can pick the right messaging primitive by distinguishing point-to-point delivery from content-based fan-out routing.

A GOOD ANSWER COVERS A message queue such as SQS is point-to-point: producers enqueue messages and one logical consumer group pulls and processes each message once, then deletes it. It excels at buffering, load leveling, decoupling a producer from a single downstream worker, retries, and smoothing spikes. An event bus such as EventBridge is publish-subscribe with routing: a producer publishes an event, and rules match on event content to deliver copies to many independent targets. It decouples a producer from a dynamic, unknown set of consumers and supports filtering, schema discovery, and integration across services and accounts. The key difference: a queue connects one source to one consumer flow, while an event bus broadcasts one event to many reactions selected by rules. You can combine them, often fanning out from a bus into per-consumer queues.

COMMON WRONG ANSWERS Calling them interchangeable. Saying SQS supports multiple independent subscribers to the same message, which it does not within one queue. Ignoring EventBridge content-based routing. Missing that buffering and retry are queue strengths.

LIKELY FOLLOW-UPS How do you get fan-out with SQS, via SNS or a bus into multiple queues? How does content filtering work? When do you put a queue behind a bus target? Ordering and exactly-once concerns?

ONE CONCRETE EXAMPLE When an order is placed, an OrderPlaced event goes to EventBridge, whose rules fan it out to a billing service, an inventory service, an email notification function, and an analytics pipeline, each reacting independently. A single SQS queue could not cleanly deliver that one event to four unrelated consumers, so the event bus is the superior choice here.

Interview question

Which use case clearly favors an event bus over a single message queue?

  • a.Broadcasting a single business event to several independent services that each react differentlyCorrect
  • b.Leveling load between a producer and one downstream worker
  • c.Ensuring one job is processed exactly once by a single consumer
  • d.Buffering a burst of tasks so one worker pool processes them at a steady rate
Why?

An event bus routes one event to many independent subscribers via rules, which a single queue cannot do. The other cases describe buffering, load leveling, and single-consumer processing, which are exactly what a message queue is built for.

Just read this? Test yourself on what you have been reading.

Read the original → nops.io

You just looked this up. Could you explain it out loud?

That is the part interviews actually test. Tezvyn takes questions like this one and gives you what the interviewer is really checking, the answer that lands, and the mistake that ends the conversation, in the four minutes before your next meeting.

The iPhone app is on the way

We are building it. Until it lands, nothing here is held back from you: every interview card, your saved cards, streaks and the job board all work in Safari, plus hundreds of free practice quizzes of thirty questions each. Sign in and it all carries over to the app the day it arrives.

Want it as an icon? Tap Share at the bottom of Safari, then Add to Home Screen. It opens full screen and the cards you have read stay available offline.

Get it on Google PlayiPhone app coming soon

We are hiring for this. Every open role lists the topics its interview covers, so you can prepare for the real thing rather than guessing.

See open roles