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.
The order reads Orders’ own copy+25A copy that catches up
BundleCreated is consumed into the copy+20What services may know
A second BundleCreated changes nothing+15Safe to repeat
A repricing that arrives first still lands+20A copy that catches up
A retired bundle leaves the copy+10A copy that catches up
A bundle missing from the copy is handled+10A copy that catches up
What it teaches
A copy that catches upintermediate
Keeping your own copy of another service’s data, updated by its events, means you keep working when it is down — at the price of a copy that is sometimes a little behind, and events that arrive twice or out of order.
Splitting a system into services is easy; the decision that matters is what they are allowed to know about each other, and the answer is a shared contract and an event rather than a reference and a call.
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.