Loading
0x70Lesson 8 of 9

Build reliable asynchronous workflows

Use queues to absorb bursts while respecting retries, ordering, and duplicate delivery.

14 min 5-question quiz
By the end of this lesson you can
  • Explain backpressure, at-least-once delivery, and the transactional outbox pattern.

A queue separates producers from workers and can absorb short bursts. If work arrives faster than workers can process it, backlog grows; backpressure limits or slows producers before the queue exhausts resources. Many brokers provide at-least-once delivery, so a message may be delivered again after a worker fails. Make handlers idempotent, track retries and dead letters, and use an outbox when a database update and event publication must not get out of sync.

The outbox writes the business update and an event record in one database transaction. A separate publisher sends pending events and marks them delivered; consumers still need idempotency because publication can repeat.

Practice: load a queue

Try it

Up to 15 XP

When does a queue stop helping?

Try each of these:

  1. Turn on the burst. Does the queue recover?
  2. Turn the burst off, then set arrivals above the service rate. What does the line do?
  3. Keep arrivals high and turn on backpressure. What did you gain, and who pays for it?
00.30.50.81061218243036424854Time (ticks)Waiting
Show the numbers as a table
Time (ticks)Messages waiting
00
10
20
30
40
50
60
70
80
90
100
110
120
130
140
150
160
170
180
190
200
210
220
230
240
250
260
270
280
290
300
310
320
330
340
350
360
370
380
390
400
410
420
430
440
450
460
470
480
490
500
510
520
530
540
550
560
570
580
590
Largest backlog
0
Longest wait
0 ticks
Rejected
0

Workers keep up, so the queue stays empty.

Practice: make delivery safe

Try it

Up to 15 XP

A message delivered twice

With at-least-once delivery, a worker can finish its job and crash before acknowledging it.

Message 1 of 5Predicted 0/0
Queue
Worker 1
Worker 2
Database

Key takeaways

  • Queues absorb bursts but do not create processing capacity.

  • Plan for duplicate delivery and make consumers idempotent.

  • Use backpressure and monitor queue age, not just queue depth.

Lesson quiz

5 questions · pass with 4 correct · up to 50 XP

Passing this quiz completes the lesson and keeps your streak going. Questions you miss come back in review sessions later.

Questions about this lesson

Stuck? Ask. Figured something out? Share it. Explaining is one of the best ways to learn.

Loading posts…