The Brand New Way to do Fault Handling in Polly V8

Поділитися
Вставка
  • Опубліковано 7 чер 2024
  • ☄️ Master the Modular Monolith Architecture: bit.ly/3SXlzSt
    📌 Accelerate your Clean Architecture skills: bit.ly/3PupkOJ
    🚀 Support me on Patreon to access the source code: / milanjovanovic
    Polly v8 was just released, and it comes with a redesigned API for fault handling. We're no longer using fault handling policies - now they're called fault handling strategies or resilience strategies. In this video, I'll show you what the new API looks like and compare it to the old API. And we'll take a look at some benchmarks to see what are the performance improvements.
    Join my weekly .NET newsletter:
    - www.milanjovanovic.tech
    Read my Blog here:
    - www.milanjovanovic.tech/blog
    Chapters
    0:00 How the Polly V7 API looks like
    5:02 Taking a look at Polly V8 ResiliencePipelineBuilder
    9:23 Supporting cancellation with Polly
    10:39 Creating a Fallback resilience strategy
    11:48 Dependency injection support in Polly V8
    14:46 Discussing Polly V8 benchmarks
  • Наука та технологія

КОМЕНТАРІ • 55

  • @MilanJovanovicTech
    @MilanJovanovicTech  8 місяців тому +3

    If you want to accelerate your .NET and software architecture skills, consider joining The .NET Weekly - my newsletter with 29k+ engineers.
    Subscribe here → www.milanjovanovic.tech

  • @sanampakuwal
    @sanampakuwal 8 місяців тому +8

    The Performance Improvement is literally impressive (mainly 0 allocation)

  • @user-vb5pg3pm3z
    @user-vb5pg3pm3z 8 місяців тому +3

    great video, Milan. Your explanations are always top-notch. Thank you and keep up the good work!

  • @pepega8572
    @pepega8572 Місяць тому +1

    Bro, your content is amazing. This is the second time I've needed to figure out how to use new library, and you help me with this. Thanks!) Keep doing this way)

  • @Sammy2100
    @Sammy2100 23 дні тому

    I am switching to this ASAP. Thanks for sharing.

    • @MilanJovanovicTech
      @MilanJovanovicTech  23 дні тому +1

      Check out this: www.milanjovanovic.tech/blog/building-resilient-cloud-applications-with-dotnet

    • @Sammy2100
      @Sammy2100 23 дні тому

      @@MilanJovanovicTech yes, I got this email notification and found this video from it.
      i have updated my .net8 code using this and its awesome. Thanks.

  • @josefromspace
    @josefromspace 3 місяці тому

    Great video, thank you very much.

  • @baranacikgoz
    @baranacikgoz 8 місяців тому +1

    Impressive video.

  • @richardaubin1951
    @richardaubin1951 7 місяців тому +1

    I've been playing around with this new version for a few hours now, and it's much easier to grasp then the previous version. Could you have a go at a video on the Dynamic Reload functionality? I think it would be good to see that in action for concurrent rate limit, retry and circuit breaker options.

    • @MilanJovanovicTech
      @MilanJovanovicTech  7 місяців тому

      Will take a look at it!

    • @tjagusz
      @tjagusz Місяць тому

      @@MilanJovanovicTech I just found this video, a circuit breaker would be awesome, especially in a microservice architecture, when for example you have a lot of messages to process and you are relying on an external API that can fail, so instead of only retrying we should stop trying for a specific time. Looking forward to this content in the next video ;)
      BTW another useful video. Thank you!

  • @antonmartyniuk
    @antonmartyniuk 8 місяців тому +2

    Interesting new concept of the library. Gonna look how the new http extensions package looks like, in most cases I prefer adding policies (strategies) when registering http client as factory in DI.
    The important thing to mention: Polly v8 doesn't need a Wrap to combine policies, it combines them automatically. And othe order is FIFO instead of FILO in Wrap policy in v7

    • @MilanJovanovicTech
      @MilanJovanovicTech  8 місяців тому

      I'll have to check for wrapping. The one test I did I got some strange behavior in the end.

    • @antonmartyniuk
      @antonmartyniuk 8 місяців тому

      @@MilanJovanovicTech I read about wrapping on the official site

  • @okcharles7
    @okcharles7 8 місяців тому +1

    As I was introduced to this kind of technique for the first time by this video, I just wonder what is the performance benefit over try-catch.

    • @MilanJovanovicTech
      @MilanJovanovicTech  8 місяців тому

      The benefit is fault handling and recovering from the exception - not necessarily the performance

  • @vikas4483
    @vikas4483 7 місяців тому +1

    Could you please make a video on best practices with sample examples on exception handling in mvc core applications

    • @MilanJovanovicTech
      @MilanJovanovicTech  7 місяців тому

      Check this out for the time being: ua-cam.com/video/H3EbflpXVmo/v-deo.html

    • @vikas4483
      @vikas4483 7 місяців тому

      @@MilanJovanovicTech Thanks 🙏

  • @antondoit
    @antondoit 4 місяці тому +1

    Great

  • @PelFox
    @PelFox 8 місяців тому +1

    Can you still hook it into service container for HttpClient? That's how I've generally used it to handle 5xx errors for all added clients.

  • @PKMuhammedSaeed
    @PKMuhammedSaeed 2 місяці тому

    Please make a video on latest
    Microsoft.Extensions.Resilience library

  • @tiagosantos2136
    @tiagosantos2136 Місяць тому

    In a clean architecture, where is the best place to put resilience strategies? in endpoints, applicatio layer, infra?

  • @MsbowElite
    @MsbowElite 5 місяців тому

    Please create a video building Unit test for http clients and retry policies.

  • @claudiovalerio7253
    @claudiovalerio7253 7 місяців тому +1

    Is it just me or the new builder stuff seems a step back?
    I mean, it probably would benefit some complex policy composition, but for simpler policies seems to be an awful lot of additional code needed to have the same result.
    Performance improvements are impressive, though...

    • @MilanJovanovicTech
      @MilanJovanovicTech  7 місяців тому

      I don't mind it, since you probably define these policies in one place and reuse them

  • @xxXAsuraXxx
    @xxXAsuraXxx 4 місяці тому

    is AddResiliencePipeline scope or transient?

    • @MilanJovanovicTech
      @MilanJovanovicTech  4 місяці тому

      "The resilience pipelines are registered in the DI container as transient services." - www.pollydocs.org/advanced/dependency-injection.html

    • @xxXAsuraXxx
      @xxXAsuraXxx 4 місяці тому

      I see but it’s cached so it won’t be a new pipeline instance everytime thanks

  • @exeC13
    @exeC13 8 місяців тому

    Using magic strings is always something that worries me.
    "How many refs does your di-pipeline-provider have / is it used at all?". [Ctrl]+[Shift]+[F] to the rescue 😖
    "Great, no compile errors" ... Runtime steps in and alerts you about a typo in your magic string 🎉

    • @MilanJovanovicTech
      @MilanJovanovicTech  8 місяців тому +1

      It's a demo damn it... Of course you will use constants 😁

  • @aakashamatya3580
    @aakashamatya3580 7 місяців тому +1

    The syntax has become too verbose.

  • @ronaldschutte7948
    @ronaldschutte7948 7 місяців тому

    Way to complicated

    • @MilanJovanovicTech
      @MilanJovanovicTech  7 місяців тому

      Not much different. We'll see where they go from here.

  • @squadwuschel
    @squadwuschel 8 місяців тому +1

    How about unit Testing an Mocking the new Poly plicies in your code?

    • @lettuceturnipthebeets790
      @lettuceturnipthebeets790 8 місяців тому

      since it supports DI and is fully based on instances now, I think it makes it even easier to prep and test the policies honestly :0

    • @MilanJovanovicTech
      @MilanJovanovicTech  8 місяців тому +1

      Isn't it easier than with a static class?

    • @W1ese1
      @W1ese1 8 місяців тому

      @@MilanJovanovicTech Question is: should you even mock the policies? I'd say no. Because in reality you want to test the scenario where the code fails for which you use the polly pipelines

  • @techpc5453
    @techpc5453 7 місяців тому +1