Implementing circuit breaker

Implementing the retry pattern is a good practice when calling services that are communicating over a network. However, the calling mechanism itself takes resources and bandwidth to execute the operation and delay the response. If the services are already in a faulted state, it is not always a good practice to retry it multiple times for every request. This is where circuit breaker plays its role.

Circuit breaker works in three states, as shown in the following diagram:

Initially, the circuit breaker is in a Closed State, which means the communication between services are working and the target remote service is ...

Get C# 7 and .NET Core 2.0 High Performance now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.