Distributed

Lesson 03.1

At-least-once delivery & idempotent consumers

At-least-once delivery means a queue may hand the same message to consumers more than once, so an idempotent consumer makes repeating a message harmless.

Reward points, added twice

Every cookie order earns the customer 10 ⭐ reward points. The shop's computer keeps a list of orders to do. Ava takes an order from the list, adds the points on the computer, then ticks the order off ✅.

If an order isn't ticked off in time, the computer gives it to Ben, in case Ava got stuck. That keeps orders from being forgotten. What could go wrong?

In this lesson you'll

  1. 1Watch a normal order.
  2. 2Guess what happens when Ava's tablet dies halfway.
  3. 3Find a rule so the points are only added once.