1. Queue
A queue sits between a producer and a consumer so they run independently and the queue absorbs traffic spikes.
queue: decouple-producer-consumerTyporithm · medium
Step 1 of 8 · intro card
Communication
A queue decouples producers from consumers and absorbs traffic spikes, while pub/sub fans an event out to many subscribers. Kafka is an ordered, partitioned log and RabbitMQ is a traditional broker; delivery is usually at-least-once, so consumers must be idempotent.
A message queue sits between a producer and a consumer. The producer drops a message and moves on; the consumer pulls it later. This decouples the two sides and lets the queue absorb spikes when consumers are slower than producers.
Pub/sub is the fan-out pattern: one published event is delivered to every subscriber, so many services can react to the same fact without the publisher knowing who they are.
Kafka models a topic as an ordered, partitioned log and keeps messages for replay; RabbitMQ is a classic broker that routes and acks messages. Most brokers offer at-least-once delivery, which can duplicate a message, so consumers must be idempotent. Kafka preserves order only within a partition.
Queue: decouples producer and consumer, absorbs spikes.
Pub/sub: fans one event out to many subscribers.
At-least-once delivery means consumers must be idempotent.
async:
queue: decouple-producer-consumer
pubsub: fan-out-events
broker: kafka-or-rabbitmq
delivery: at-least-once
ordering: per-partitionConnect each part of the code to the concept before you type.
A queue sits between a producer and a consumer so they run independently and the queue absorbs traffic spikes.
queue: decouple-producer-consumerPub/sub publishes an event once and fans it out to every interested subscriber.
pubsub: fan-out-eventsKafka is an ordered, partitioned log; RabbitMQ is a traditional message broker — both move messages between services.
broker: kafka-or-rabbitmqAt-least-once delivery may deliver a message more than once, so consumers must handle duplicates idempotently.
delivery: at-least-onceKafka guarantees order within a partition, not across the whole topic.
ordering: per-partitionRead the concept map and follow the code breakdown.
Type the implementation, repair mistakes and work through every recall exercise.
Use the final check without hints; revisit weak concepts in short practice sessions.