Chapter 15
Idempotent Receiver
Identify requests from clients uniquely so you can ignore duplicate requests when client retries.
Problem
Clients send requests to servers but might not get a response. It’s impossible for clients to know if the response was lost or the server crashed before processing the request. To make sure its request is processed, the client has to resend the request.
If a server had already processed the request and crashed after that, servers will get duplicate requests from the client when it retries.
Solution
Identify a client uniquely by assigning a unique ID to each client. Before sending any requests, the client registers itself with the server.
class ConsistentCoreClient... private ...
Get Patterns of Distributed Systems now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.