CoreSystem.Idempotency
2.0.0
dotnet add package CoreSystem.Idempotency --version 2.0.0
NuGet\Install-Package CoreSystem.Idempotency -Version 2.0.0
<PackageReference Include="CoreSystem.Idempotency" Version="2.0.0" />
<PackageVersion Include="CoreSystem.Idempotency" Version="2.0.0" />
<PackageReference Include="CoreSystem.Idempotency" />
paket add CoreSystem.Idempotency --version 2.0.0
#r "nuget: CoreSystem.Idempotency, 2.0.0"
#:package CoreSystem.Idempotency@2.0.0
#addin nuget:?package=CoreSystem.Idempotency&version=2.0.0
#tool nuget:?package=CoreSystem.Idempotency&version=2.0.0
⚡ CoreSystem.Idempotency
A production-ready idempotency framework for ASP.NET Core that guarantees exactly-once request execution for distributed applications.
CoreSystem.Idempotency transparently intercepts incoming requests, validates request fingerprints, persists successful responses through pluggable storage providers, and safely replays completed operations.
Designed around a provider-based architecture, the framework remains completely independent from the underlying persistence technology while providing built-in OpenTelemetry instrumentation and production-ready defaults.
✨ Features
- ✅ ASP.NET Core middleware
- ✅ Exactly-once request execution
- ✅ Request fingerprint validation
- ✅ Automatic response replay
- ✅ Duplicate request detection
- ✅ Provider-independent storage architecture
- ✅ Configurable request fingerprinting
- ✅ Configurable expiration
- ✅ Configurable HTTP methods
- ✅ Built-in OpenTelemetry metrics
- ✅ Extensible through
IIdempotencyStorage - ✅ Production-ready architecture
📦 Available Storage Providers
CoreSystem.Idempotency requires a storage provider.
| Package | Description |
|---|---|
| CoreSystem.Idempotency.Redis | Redis-based distributed storage |
| CoreSystem.Idempotency.PostgreSql | PostgreSQL-based durable storage |
Additional providers can be implemented by using the IIdempotencyStorage abstraction.
🚀 Quick Start
1. Install the framework
dotnet add package CoreSystem.Idempotency
2. Install a storage provider
Redis
dotnet add package CoreSystem.Idempotency.Redis
PostgreSQL
dotnet add package CoreSystem.Idempotency.PostgreSql
3. Register the framework
builder.Services
.AddCoreIdempotency(options =>
{
builder.Configuration
.GetSection("Core:Idempotency")
.Bind(options);
});
Register the storage provider.
builder.Services.AddCoreIdempotencyRedis();
or
builder.Services.AddCoreIdempotencyPostgreSql();
4. Enable the middleware
app.UseCoreIdempotency();
5. Configure the framework
{
"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
CoreSystem.Idempotency publishes OpenTelemetry metrics out of the box.
Available metrics include:
- Request processing
- Cache hits and misses
- Response replay
- Storage read latency
- Storage write latency
- Persisted payload size
Compatible with:
- OpenTelemetry
- Prometheus
- Grafana
- Azure Monitor
- Jaeger
- Elastic
- 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
The complete documentation includes:
- Getting Started
- Architecture
- Configuration
- Request Lifecycle
- Fingerprinting
- Response Replay
- Storage Providers
- Observability
- Best Practices
- Error Reference
- Roadmap
🤝 Contributing
Contributions, bug reports, feature requests, and new storage providers are always welcome.
If you'd like to contribute:
- Fork the repository.
- Create a feature branch.
- Submit a Pull Request.
📄 License
MIT License © Federin Pastor Gutierrez Ortiz
| 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 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. |
-
net8.0
- CoreSystem.Http (>= 1.0.6)
- CoreSystem.Observability.Abstractions (>= 1.0.0)
- CoreSystem.Serialization (>= 1.2.0)
- MessagePack (>= 3.1.8)
- Microsoft.Extensions.Configuration (>= 8.0.0)
- Microsoft.Extensions.Configuration.Abstractions (>= 8.0.0)
- Microsoft.Extensions.Configuration.Binder (>= 8.0.2)
- Microsoft.Extensions.DependencyInjection (>= 8.0.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.2)
- Microsoft.Extensions.Diagnostics.HealthChecks (>= 8.0.28)
- Microsoft.Extensions.Options (>= 8.0.2)
- OpenTelemetry (>= 1.15.3)
- OpenTelemetry.Api (>= 1.15.3)
- OpenTelemetry.Extensions.Hosting (>= 1.15.3)
- protobuf-net (>= 3.2.56)
- protobuf-net.Core (>= 3.2.56)
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 automatic schema creation and Dapper-based data access. |
|
|
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.