Excalibur.LeaderElection.Consul
3.0.0-alpha.19
This is a prerelease version of Excalibur.LeaderElection.Consul.
dotnet add package Excalibur.LeaderElection.Consul --version 3.0.0-alpha.19
NuGet\Install-Package Excalibur.LeaderElection.Consul -Version 3.0.0-alpha.19
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="Excalibur.LeaderElection.Consul" Version="3.0.0-alpha.19" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Excalibur.LeaderElection.Consul" Version="3.0.0-alpha.19" />
<PackageReference Include="Excalibur.LeaderElection.Consul" />
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 Excalibur.LeaderElection.Consul --version 3.0.0-alpha.19
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Excalibur.LeaderElection.Consul, 3.0.0-alpha.19"
#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 Excalibur.LeaderElection.Consul@3.0.0-alpha.19
#: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=Excalibur.LeaderElection.Consul&version=3.0.0-alpha.19&prerelease
#tool nuget:?package=Excalibur.LeaderElection.Consul&version=3.0.0-alpha.19&prerelease
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Excalibur.LeaderElection.Consul
HashiCorp Consul implementation of distributed leader election using sessions and KV store.
Installation
dotnet add package Excalibur.LeaderElection.Consul
Features
- Uses Consul sessions with KV store for distributed locking
- Session TTL with automatic renewal
- Lock delay for graceful failover
- ACL token support for secure environments
- Multi-datacenter support
- Health check integration
- AOT-compatible with full Native AOT support
Usage
// Register Consul leader election
services.AddConsulLeaderElection(options =>
{
options.ConsulAddress = "http://localhost:8500";
options.KeyPrefix = "myapp/leader-election";
options.SessionTTL = TimeSpan.FromSeconds(30);
options.LockDelay = TimeSpan.FromSeconds(15);
});
// Or for a specific resource
services.AddConsulLeaderElectionForResource("order-processor");
Configuration Options
| Option | Default | Description |
|---|---|---|
ConsulAddress |
http://localhost:8500 |
Consul server address |
Datacenter |
null |
Target datacenter |
Token |
null |
ACL token for authentication |
KeyPrefix |
excalibur/leader-election |
KV store key prefix |
SessionTTL |
30 seconds | Session time-to-live |
LockDelay |
15 seconds | Delay before lock reacquisition |
HealthCheckId |
null |
Health check to bind session |
How It Works
Consul provides distributed locking via sessions:
- Create session with TTL and optional health check binding
- Acquire lock via
PUT ?acquire=<session>on KV key - Only one session can hold the lock at a time
- Session invalidation releases the lock after lock delay
Related Packages
Excalibur.LeaderElection- Core abstractions and InMemory implementation
License
This project is multi-licensed under:
See LICENSE for details.
| 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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net10.0
- Consul (>= 1.7.14.9)
- Excalibur.LeaderElection (>= 3.0.0-alpha.19)
- Medo.Uuid7 (>= 1.4.0)
- Microsoft.Extensions.Configuration (>= 10.0.0)
- Microsoft.Extensions.Configuration.Abstractions (>= 10.0.0)
- Microsoft.Extensions.Configuration.Binder (>= 10.0.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.0)
- Microsoft.Extensions.Diagnostics.HealthChecks (>= 10.0.0)
- Microsoft.Extensions.Diagnostics.HealthChecks.Abstractions (>= 10.0.0)
- Microsoft.Extensions.Hosting.Abstractions (>= 10.0.0)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.0)
- Microsoft.Extensions.Options (>= 10.0.0)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 10.0.0)
- Microsoft.Extensions.Options.DataAnnotations (>= 10.0.0)
- Polly (>= 8.6.4)
-
net8.0
- Consul (>= 1.7.14.9)
- Excalibur.LeaderElection (>= 3.0.0-alpha.19)
- Medo.Uuid7 (>= 1.4.0)
- Microsoft.Extensions.Configuration (>= 10.0.0)
- Microsoft.Extensions.Configuration.Abstractions (>= 10.0.0)
- Microsoft.Extensions.Configuration.Binder (>= 10.0.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.0)
- Microsoft.Extensions.Diagnostics.HealthChecks (>= 10.0.0)
- Microsoft.Extensions.Diagnostics.HealthChecks.Abstractions (>= 10.0.0)
- Microsoft.Extensions.Hosting.Abstractions (>= 10.0.0)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.0)
- Microsoft.Extensions.Options (>= 10.0.0)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 10.0.0)
- Microsoft.Extensions.Options.DataAnnotations (>= 10.0.0)
- Polly (>= 8.6.4)
- System.Diagnostics.DiagnosticSource (>= 10.0.0)
-
net9.0
- Consul (>= 1.7.14.9)
- Excalibur.LeaderElection (>= 3.0.0-alpha.19)
- Medo.Uuid7 (>= 1.4.0)
- Microsoft.Extensions.Configuration (>= 10.0.0)
- Microsoft.Extensions.Configuration.Abstractions (>= 10.0.0)
- Microsoft.Extensions.Configuration.Binder (>= 10.0.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.0)
- Microsoft.Extensions.Diagnostics.HealthChecks (>= 10.0.0)
- Microsoft.Extensions.Diagnostics.HealthChecks.Abstractions (>= 10.0.0)
- Microsoft.Extensions.Hosting.Abstractions (>= 10.0.0)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.0)
- Microsoft.Extensions.Options (>= 10.0.0)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 10.0.0)
- Microsoft.Extensions.Options.DataAnnotations (>= 10.0.0)
- Polly (>= 8.6.4)
- System.Diagnostics.DiagnosticSource (>= 10.0.0)
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 |
|---|---|---|
| 3.0.0-alpha.19 | 32 | 2/26/2026 |