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 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.