Skip to content

Migrate the Polly resilience sample into CodeMazeGuides on .NET 10 and Polly 8 - #2135

Merged
vladimir-pecanac-main merged 2 commits into
CodeMazeBlog:mainfrom
vladimir-pecanac-main:seo/57419-creating-resilient-microservices-in-net-with-polly
Aug 24, 2026
Merged

Migrate the Polly resilience sample into CodeMazeGuides on .NET 10 and Polly 8#2135
vladimir-pecanac-main merged 2 commits into
CodeMazeBlog:mainfrom
vladimir-pecanac-main:seo/57419-creating-resilient-microservices-in-net-with-polly

Conversation

@vladimir-pecanac-main

Copy link
Copy Markdown
Collaborator

Source for Creating Resilient Microservices in .NET with Polly lived in the standalone CodeMazeBlog/resilient-microservices-dotnet-polly repository, on .NET 5 and Polly 7.2.1, outside this repo's per-article build check.

This migrates it in as dotnet-client-libraries/ResilienceWithPolly, following the testing-series shape: StarterCode and FinishedCode side by side, plus an aggregate ResilienceWithPolly.sln at the folder root so CI has a solution at the two-level path it looks for.

  • every project retargeted to net10.0 and converted to minimal hosting
  • the gateway's v7 policies (AsyncFallbackPolicy, AsyncRetryPolicy, AsyncCircuitBreakerPolicy, AsyncPolicyWrap) rewritten as one Polly 8 ResiliencePipeline, registered with the DI container instead of held in a static field behind a null check
  • Thread.Sleep(5000) in the Authors failure simulation replaced with await Task.Delay
  • a Tests project, which the standalone repository never had: the retry recovers one transient failure, the fallback message is returned when every attempt fails, and the circuit opens and short-circuits the dependency

dotnet build and dotnet test are clean on .NET 10.0.302 — 0 warnings, 5/5 tests.

…d Polly 8

The sample for "Creating Resilient Microservices in .NET with Polly" lived in
the standalone CodeMazeBlog/resilient-microservices-dotnet-polly repository,
which predates this repo and therefore sat outside the per-article build check.
It targeted .NET 5 and Polly 7.2.1.

- dotnet-client-libraries/ResilienceWithPolly with StarterCode and FinishedCode
  side by side and an aggregate ResilienceWithPolly.sln at the folder root
- every project retargeted to net10.0 and converted to minimal hosting
- the gateway's v7 policies (AsyncFallbackPolicy, AsyncRetryPolicy,
  AsyncCircuitBreakerPolicy, AsyncPolicyWrap) rewritten as one Polly 8
  ResiliencePipeline, registered with the DI container instead of held in a
  static field behind a null check
- Thread.Sleep(5000) in the Authors failure simulation replaced with
  await Task.Delay, so the simulation stops demonstrating thread starvation in
  an article about resilience
- Tests project covering the pipeline: the retry recovers one transient
  failure, the fallback message is returned when every attempt fails, and the
  circuit opens and short-circuits the dependency
The starter project has no failure simulation, so there is nothing to await.
The async signature arrives in the finished project along with the Task.Delay
that replaces Thread.Sleep, which is where the article introduces it.
@vladimir-pecanac-main
vladimir-pecanac-main merged commit 131368e into CodeMazeBlog:main Aug 24, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant