CoreSystem.Idempotency
2.1.0
dotnet add package CoreSystem.Idempotency --version 2.1.0
NuGet\Install-Package CoreSystem.Idempotency -Version 2.1.0
<PackageReference Include="CoreSystem.Idempotency" Version="2.1.0" />
<PackageVersion Include="CoreSystem.Idempotency" Version="2.1.0" />
<PackageReference Include="CoreSystem.Idempotency" />
paket add CoreSystem.Idempotency --version 2.1.0
#r "nuget: CoreSystem.Idempotency, 2.1.0"
#:package CoreSystem.Idempotency@2.1.0
#addin nuget:?package=CoreSystem.Idempotency&version=2.1.0
#tool nuget:?package=CoreSystem.Idempotency&version=2.1.0
⚡ CoreSystem.Idempotency
Production-ready idempotency for ASP.NET Core that suppresses concurrent duplicates and replays persisted responses.
CoreSystem.Idempotency is a middleware-based idempotency framework for distributed applications. It fingerprints incoming requests, persists successful responses through pluggable storage providers, and replays completed operations instead of executing them twice.
The package targets .NET 8, .NET 9 and .NET 10, and ships an assembly for each of those frameworks.
✨ Features
- ✅ ASP.NET Core middleware
- ✅ Concurrent duplicate suppression
- ✅ Response replay from persisted entries
- ✅ Request fingerprint validation
- ✅ Duplicate request detection
- ✅ Provider-independent storage architecture
- ✅ Configurable expiration, methods and fingerprinting
- ✅ Built-in OpenTelemetry metrics
- ✅ Extensible through
IIdempotencyStorage
📦 Installation
Install the framework, then a storage provider. A provider is required.
dotnet add package CoreSystem.Idempotency
| Package | Purpose |
|---|---|
| CoreSystem.Idempotency.Redis | Redis-based distributed storage |
| CoreSystem.Idempotency.PostgreSql | PostgreSQL-based durable storage |
Additional providers can be implemented through the IIdempotencyStorage abstraction.
🚀 Quick Start
Register the framework.
builder.Services
.AddCoreIdempotency(options =>
{
builder.Configuration
.GetSection("Core:Idempotency")
.Bind(options);
});
Register a storage provider. Both providers require a configuration delegate.
builder.Services.AddCoreIdempotencyRedis(options =>
{
options.Configuration = redis =>
{
redis.EndPoints.Add("localhost:6379");
};
});
builder.Services.AddCoreIdempotencyPostgreSql(options =>
{
options.ConnectionString =
builder.Configuration.GetConnectionString("Idempotency");
});
Enable the middleware.
app.UseCoreIdempotency();
Configure through the Core:Idempotency section.
{
"Core": {
"Idempotency": {
"Enabled": true,
"InstanceName": "Orders",
"Expiration": "06:00:00",
"AllowedMethods": [ "POST", "PUT" ]
}
}
}
🔒 How It Works
Incoming Request
│
▼
Resolve Idempotency Key
│
▼
Generate Request Fingerprint
│
▼
Lookup IIdempotencyStorage
│
┌─────┴─────┐
│ │
Found Not Found
│ │
▼ ▼
Replay Execute Endpoint
Response │
▼
Persist Response
Every duplicate request receives the original response without executing the application endpoint again.
📊 Built-in Observability
OpenTelemetry metrics are published out of the box: request processing, cache hits and misses, response replay, storage read and write latency, and persisted payload size.
Compatible with OpenTelemetry, Prometheus, Grafana, Azure Monitor, Jaeger, Elastic and Datadog.
🏗 Architecture
CoreSystem.Idempotency coordinates the idempotency workflow while remaining completely independent from storage implementations.
ASP.NET Core
│
▼
CoreSystem.Idempotency
│
▼
IIdempotencyStorage
│
┌────┴────┐
▼ ▼
Redis PostgreSQL
Future Providers
This provider-based architecture allows new storage implementations to be introduced without modifying the core framework.
📚 Documentation
- Getting Started
- Architecture and configuration
- Storage providers: Redis, PostgreSQL
- Delivery guarantees
- Fingerprinting and response replay
- Observability and error reference
🤝 Contributing
Contributions, bug reports, feature requests and new storage providers are always welcome. Fork the repository, create a feature branch, and open a pull request.
📄 License
Released under the MIT License.
| Product | Versions 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 is compatible. 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. |
-
net10.0
- CoreSystem.Http (>= 1.2.0)
- CoreSystem.Observability.Abstractions (>= 1.1.0)
- CoreSystem.Serialization (>= 1.3.0)
- OpenTelemetry.Extensions.Hosting (>= 1.20.1)
-
net8.0
- CoreSystem.Http (>= 1.2.0)
- CoreSystem.Observability.Abstractions (>= 1.1.0)
- CoreSystem.Serialization (>= 1.3.0)
- OpenTelemetry.Extensions.Hosting (>= 1.20.1)
-
net9.0
- CoreSystem.Http (>= 1.2.0)
- CoreSystem.Observability.Abstractions (>= 1.1.0)
- CoreSystem.Serialization (>= 1.3.0)
- OpenTelemetry.Extensions.Hosting (>= 1.20.1)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on CoreSystem.Idempotency:
| Package | Downloads |
|---|---|
|
CoreSystem.Idempotency.PostgreSql
Production-ready PostgreSQL storage provider for CoreSystem.Idempotency, providing durable persistence through the IIdempotencyStorage abstraction with Dapper-based data access. Ships an idempotent schema script at scripts/postgres.sql. |
|
|
CoreSystem.Idempotency.Redis
Production-ready Redis storage provider for CoreSystem.Idempotency, providing high-performance distributed persistence through the IIdempotencyStorage abstraction. |
GitHub repositories
This package is not used by any popular GitHub repositories.
2.1.0: Multi-targeting release. The package now ships net8.0, net9.0 and net10.0 assets instead of net8.0 only, so a project on .NET 9 or .NET 10 gets an assembly compiled for its own target framework.
Dependency refresh. No code or API changes.
CoreSystem.Observability.Abstractions 1.0.1 to 1.0.2,
CoreSystem.Serialization 1.2.3 to 1.2.4 and
OpenTelemetry.Extensions.Hosting 1.19.0 to 1.20.0, plus the refreshed
transitive graph. The declared dependency floors now match the versions
the assembly was built and tested against.