Request Waiting List
Track client requests which require responses after the criteria to respond is met based on responses from other cluster nodes.
Problem
A cluster node needs to communicate with other cluster nodes to replicate data while processing a client request. A response from all other cluster nodes or a Majority Quorum is needed before responding to clients.
Communication to other cluster nodes is done asynchronously. Asynchronous communication allows patterns like Request Pipeline and Request Batch to be used.
So the cluster node receives and processes responses from multiple other cluster nodes asynchronously. It then needs to correlate them to check if the Majority Quorum for a particular client request is reached.
Solution
The cluster node maintains a waiting list which maps a key and a callback function. The key is chosen depending on the specific criteria to invoke the callback. For example, if it needs to be invoked whenever a message from other cluster node is received, it can be the correlation ID of the message. In the case of Replicated Log, it is the High-Water Mark. The callback handles the response and decides if the client request can be fulfilled.
for more details go to Chapter 14 of the online ebook at oreilly.com
This pattern is part of Patterns of Distributed Systems
23 November 2023