AsyncRequestReply 0.1.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package AsyncRequestReply --version 0.1.0
                    
NuGet\Install-Package AsyncRequestReply -Version 0.1.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="AsyncRequestReply" Version="0.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="AsyncRequestReply" Version="0.1.0" />
                    
Directory.Packages.props
<PackageReference Include="AsyncRequestReply" />
                    
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 AsyncRequestReply --version 0.1.0
                    
#r "nuget: AsyncRequestReply, 0.1.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 AsyncRequestReply@0.1.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=AsyncRequestReply&version=0.1.0
                    
Install as a Cake Addin
#tool nuget:?package=AsyncRequestReply&version=0.1.0
                    
Install as a Cake Tool

AsyncRequestReply

AsyncRequestReply is a minimal ASP.NET Core library for the Asynchronous Request-Reply pattern.

It lets an HTTP endpoint accept work, enqueue it, return 202 Accepted immediately, and expose a polling endpoint where clients can check the job status later. The library owns the HTTP pattern and status contract. The host application owns the real business processing.

This first version uses in-memory queue and status store implementations. Redis, Hangfire, MassTransit, or any durable transport can be added later by replacing the public interfaces.

Local package installation

Build the NuGet package locally:

dotnet pack src/AsyncRequestReply/AsyncRequestReply.csproj -c Release

Install it from the generated package folder:

dotnet add package AsyncRequestReply --source ./src/AsyncRequestReply/bin/Release

ASP.NET Core configuration

using AsyncRequestReply;

var builder = WebApplication.CreateBuilder(args);

builder.Services.AddAsyncRequestReply(options =>
{
    options.StatusBasePath = "/async-status";
    options.ExposeStatusEndpoint = true;
});

builder.Services.AddSingleton<IAsyncJobProcessor, OrderProcessor>();

var app = builder.Build();

app.MapAsyncRequestReplyStatusEndpoints();

app.MapPost("/orders", () => Results.NoContent())
    .AsAsyncRequestReply(options => options.PayloadPath = "data");

app.Run();

If no IAsyncJobProcessor is registered, accepted jobs remain in queued until a host application provides processing.

Async endpoint

The endpoint marked with .AsAsyncRequestReply(...) reads the request body, extracts the configured payload, stores the initial status, enqueues the job, and returns:

{
  "id": "{jobId}",
  "status": "queued",
  "location": "/async-status/status/{jobId}"
}

The HTTP response status is 202 Accepted and the Location header contains the polling URL.

With PayloadPath = "data", this request enqueues only the nested data object:

{
  "data": {
    "name": "order-1"
  }
}

Processor example

using AsyncRequestReply;

public sealed class OrderProcessor : IAsyncJobProcessor
{
    public Task<object?> ProcessAsync(string jobId, object? payload, CancellationToken cancellationToken = default)
    {
        return Task.FromResult<object?>(new
        {
            message = "Order processed",
            jobId,
            payload
        });
    }
}

Successful processors move the job to completed. Exceptions move the job to failed and store the exception message in error.

Status endpoint

Register status polling with:

app.MapAsyncRequestReplyStatusEndpoints();

Default route:

GET /async-status/status/{jobId}

Response body:

{
  "id": "{jobId}",
  "status": "queued",
  "result": null,
  "error": null,
  "createdAt": "2026-06-08T00:00:00+00:00",
  "updatedAt": "2026-06-08T00:00:00+00:00"
}

Supported statuses are queued, processing, waiting_external, completed, failed, and not_found.

Commands

dotnet build
dotnet test
dotnet pack src/AsyncRequestReply/AsyncRequestReply.csproj -c Release
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 was computed.  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.
  • net8.0

    • No dependencies.

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
0.2.1 92 8/1/2026
0.2.0 81 8/1/2026
0.1.0 77 6/11/2026