A client interceptor is a gRPC component that modifies or enriches a request before it reaches the server. It provides a central place to apply cross-cutting client-side behavior, such as circuit-breaker logic, instead of wrapping every dependent-service call separately. section 6.1.3
A circuit-breaker client interceptor typically:
- Accepts a circuit breaker and returns a grpc.UnaryClientInterceptor. section 6.1.3
- Applies the behavior at client connection setup so calls to an unavailable service fail through the breaker rather than being sent blindly. section 6.1.3
Protecting order creation
An order client invokes Create through a circuit breaker. The interceptor generalizes that protection: it executes each unary RPC through gobreaker and returns the resulting error to the caller.
