The architectural design pattern created to deal with the problems described previously is the circuit breaker pattern. The main idea behind it is simple: wrap the invocation code into the command, which will perform the invocation, and calculate the status of the remote service. If the service is declared unreachable by the metrics used by the command, then the next invocations are rejected immediately. After a given time, new connections will be tried again, and, if successful, the command will start performing invocations to the service again.
The name of the pattern was taken from the electrical circuit breaker, a device used to protect the electrical circuit from the damage that may result from the excess electrical current. If the current in the circuit is too high then the circuit breaker opens, preventing the current from flowing. In order to...