HomeChallengesRepsProblemsLeaderboardTake a challenge

Asking Catalogue on every order

Orders calls Catalogue for a price on every purchase, so Catalogue being down means nobody can buy anything. Keep a local copy of the bundles, updated by Catalogue’s events, including the ones that arrive twice or in the wrong order.

Intermediate25 min on the clock6 graded checks · 100 pointsServices That Fail Politely

See alsoSplitting the MonolithThe same rule from the publisher’s side: an event in a shared contract instead of a call, with ABP doing the wiring.

Graded by reading your code against the checklist below.

What you build

  • Read the bundle from Orders’ own copy, not from Catalogue
  • Handle a bundle that is not in the copy
  • Consume BundleCreated into the copy
  • Make a second BundleCreated change nothing
  • Handle BundleRepriced arriving before BundleCreated
  • Remove the copy when the bundle is retired

Done means

Orders reads its own copy, the copy is kept by idempotent consumers that tolerate reordering, and a missing bundle is handled.

How it is graded

Published in full, before you start — every point is one of these and there is nothing else.

  1. The order reads Orders’ own copy+25A copy that catches up
  2. BundleCreated is consumed into the copy+20What services may know
  3. A second BundleCreated changes nothing+15Safe to repeat
  4. A repricing that arrives first still lands+20A copy that catches up
  5. A retired bundle leaves the copy+10A copy that catches up
  6. A bundle missing from the copy is handled+10A copy that catches up

What it teaches

Safe to repeatintermediate

A request that times out has not necessarily failed — you just did not hear back — so the client retries, and unless the write recognises that it has already happened the customer is charged twice.

The rest of Services That Fail Politely