wasAsked.

How do you make a .NET API resilient to a slow or failing third-party service using timeouts, retries, and circuit breakers?

Zomato · Full Stack Developer · 3-4-years · technical

Published

Year not specified · .NET, Microservices, Software Engineering

Community answers

Posted by wasAsked editorial collection

Give every remote call a timeout and cancellation token. Retry only transient failures and only when the operation is safe or protected by an idempotency key; use exponential backoff with jitter. A circuit breaker limits pressure during sustained failure. Example: builder.Services.AddHttpClient<PaymentClient>() .AddStandardResilienceHandler(); Validate the actual handler policy for your .NET version: separate attempt and total timeouts, bounded retries, and sensible breaker thresholds. Limit concurrency, verify TLS, keep credentials in a secret store, and log correlation IDs without sensitive payloads. Model ambiguous outcomes explicitly—if a payment call times out, query by idempotency key before charging again. Provide degraded behavior only when it is truthful and safe.

Backbencher Developer · · 0 likes

Sign in to add your answer

Related interview topics