Messaging
A queue between two services lets one of them hand work over without waiting for the other. That is a large gain, and it brings a new set of questions: who gets each message, what happens when the consumers fall behind, what happens when a consumer crashes half way, and what a message that arrives twice does. This module is about those questions, for a work queue and for a log-based broker.
You will work with a live queue lab, with a sorting exercise, a quiz and two C# examples, a background worker and a transactional outbox, and every lesson has a moment where you slow the consumers down, crash one, lose an acknowledgement or send too much to one key.
The lessons
Section titled “The lessons”- Queues, pub/sub and consumer lag (18 min). What a queue changes, the difference between a work queue and publish/subscribe, and how a backlog grows.
- Backpressure and bounded queues (16 min). What a full queue should do, and how a refusal slows the producers to the rate the consumers sustain.
- Retries and dead-letter queues (20 min). How an unacknowledged message comes back, what a poison message does, and where the failures go.
- Delivery semantics: at most once, at least once, effectively once (22 min). Why the moment of the acknowledgement decides between a loss and a repeat, and how to get an effectively-once result.
- Partitioned logs and consumer groups (22 min). Topics as partitions, order inside a partition, and why a group cannot use more consumers than partitions.
- Offsets, commits and replay (18 min). The committed offset, what a crash repeats, and what a shorter commit interval buys.
- Recap and quiz (12 min). The module in one page, a design checklist, and a quiz.
What you will be able to do
Section titled “What you will be able to do”- Say whether a queue will grow from the producer rate and the consumers’ rates, and how many consumers stop it.
- Choose between a work queue and publish/subscribe for a use, and say what each one gives each consumer.
- Design what a full queue does, and what retries, a visibility timeout and a dead-letter queue do for a failing message.
- Pick a delivery guarantee, say what failure it accepts, and get an effectively-once result with an idempotent consumer and an outbox.
- Reason about partitions, keys, consumer groups and committed offsets: what stays in order, what is repeated after a crash, and what a hot key does.
All the numbers in the labs are illustrative. They are for comparing choices, not for forecasting any real product.
Built by GhaziAlibi.
© ShardCraft. All rights reserved.