5 concepts · 10 practice questions
A message queue hands each message to one consumer and deletes it once acknowledged, which suits distributing work across competing workers. A log (Kafka is the usual example) appends records and keeps them for a retention period; each consumer group tracks its own offset, so several independent services read the same stream at their own pace, and any of them can rewind and replay. Choose a queue for jobs, a log for event streams that many readers need or that you may need to reprocess.
# Queue: one worker gets the message; it is removed once acked
msg = queue.receive(visibility_timeout=30)
handle(msg.body)
queue.ack(msg)
# Log: records stay; each consumer group keeps its own offset
for record in consumer.poll(topic="orders", group="billing"):
handle(record.value)
consumer.commit() # billing moves on; analytics reads at its own pace
Sign in to read the rest and take the 10-question test.
Sign in to continue