Rivulet.Polly 2.0.0

dotnet add package Rivulet.Polly --version 2.0.0
                    
NuGet\Install-Package Rivulet.Polly -Version 2.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Rivulet.Polly" Version="2.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Rivulet.Polly" Version="2.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Rivulet.Polly" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Rivulet.Polly --version 2.0.0
                    
#r "nuget: Rivulet.Polly, 2.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Rivulet.Polly@2.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Rivulet.Polly&version=2.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Rivulet.Polly&version=2.0.0
                    
Install as a Cake Tool

Rivulet.Polly

Integration between Rivulet parallel processing and Polly resilience policies.

Features

  • Use Polly policies with Rivulet - Apply any Polly policy to parallel operations
  • Convert Rivulet to Polly - Use Rivulet configuration as standalone Polly policies
  • Advanced resilience patterns - Hedging, result-based retry, and more
  • Battle-tested - Built on Polly's production-proven resilience library

API

  • SelectParallelWithPolicyAsync - Apply Polly policies to parallel operations
  • SelectParallelWithHedgingAsync - Hedging pattern (parallel redundant requests)
  • SelectParallelWithResultRetryAsync - Result-based retry with Polly policies
  • ToPollyRetryPipeline - Convert Rivulet retry to Polly pipeline

Installation

dotnet add package Rivulet.Polly

Quick Start

Use Polly Policies with Rivulet

using Polly;
using Rivulet.Polly;

// Create a Polly retry policy
var retryPolicy = new ResiliencePipelineBuilder()
    .AddRetry(new RetryStrategyOptions
    {
        MaxRetryAttempts = 3,
        Delay = TimeSpan.FromSeconds(1),
        BackoffType = DelayBackoffType.Exponential
    })
    .Build();

// Apply it to parallel processing
var results = await items.SelectParallelWithPolicyAsync(
    async (item, ct) => await ProcessAsync(item, ct),
    retryPolicy,
    new ParallelOptionsRivulet { MaxDegreeOfParallelism = 10 });

Convert Rivulet Options to Polly

var rivuletOptions = new ParallelOptionsRivulet
{
    MaxRetries = 3,
    IsTransient = ex => ex is HttpRequestException,
    BackoffStrategy = BackoffStrategy.ExponentialJitter,
    BaseDelay = TimeSpan.FromMilliseconds(100)
};

// Convert to Polly pipeline for standalone use
var pollyPipeline = rivuletOptions.ToPollyRetryPipeline();

// Use anywhere
var result = await pollyPipeline.ExecuteAsync(async ct => await CallApiAsync(ct));

Advanced Features

Hedging (Reduce Tail Latency)
// Send hedged requests if first is slow
var results = await urls.SelectParallelWithHedgingAsync(
    async (url, ct) => await httpClient.GetAsync(url, ct),
    maxHedgedAttempts: 2,
    hedgingDelay: TimeSpan.FromMilliseconds(100));
Result-Based Retry
// Retry based on result value, not just exceptions
var results = await urls.SelectParallelWithResultRetryAsync(
    async (url, ct) => await httpClient.GetAsync(url, ct),
    shouldRetry: response => response.StatusCode == HttpStatusCode.TooManyRequests,
    maxRetries: 3);

License

MIT License - see LICENSE file for details


Made with ❤️ by Jeffeek | NuGet | GitHub

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.0.0 88 3/24/2026
1.3.0 168 12/13/2025
1.3.0-beta 421 12/8/2025
1.3.0-alpha 297 12/8/2025