Skip to content
Exercise · Choosing a broker · lesson 4 of 6

Exercise: an idempotent payment consumer

A payment service receives messages from a broker about money on a shop's account: a customer's payment or a refund. The broker delivers them at-least-once, so one message can arrive twice, even to two consumers at once, and money must never be charged or credited twice. The broker and the database in this exercise are a model in the tests file, not real systems.