DLeader.Consul.Messaging
2.0.1
dotnet add package DLeader.Consul.Messaging --version 2.0.1
NuGet\Install-Package DLeader.Consul.Messaging -Version 2.0.1
<PackageReference Include="DLeader.Consul.Messaging" Version="2.0.1" />
<PackageVersion Include="DLeader.Consul.Messaging" Version="2.0.1" />
<PackageReference Include="DLeader.Consul.Messaging" />
paket add DLeader.Consul.Messaging --version 2.0.1
#r "nuget: DLeader.Consul.Messaging, 2.0.1"
#:package DLeader.Consul.Messaging@2.0.1
#addin nuget:?package=DLeader.Consul.Messaging&version=2.0.1
#tool nuget:?package=DLeader.Consul.Messaging&version=2.0.1
DLeader.Consul.Messaging
Best-effort message fan-out between the instances of a service, carried over the HashiCorp Consul KV store. Split out of DLeader.Consul in 2.0, where it was deprecated in 1.13.
dotnet add package DLeader.Consul.Messaging
builder.Services.AddConsulMessaging(consul =>
{
consul.ServiceName = "invoice-worker";
consul.Address = "http://consul:8500";
});
await broker.SubscribeAsync("cache-invalidate", async key =>
{
_cache.Remove(key);
});
await broker.BroadcastAsync("cache-invalidate", "customer:42");
What this is not
It is not a queue, and no setting makes it one.
- A subscriber receives what is published after
SubscribeAsynccompletes — not before. - Messages are swept after
MessageBrokerOptions.Retention(five minutes by default). An instance that is down for longer never sees what it missed. Raising the retention widens the window; it does not make delivery reliable. - Delivery is normally exactly once per subscriber and in the order Consul accepted the messages, but a retry after a failed watch can redeliver. Handlers must tolerate that.
- There is no acknowledgement, no dead-letter, no replay, and no durability.
It suits coordination chatter — "the cache changed", "reload your config" — where missing a message is survivable because the next one supersedes it. Anything that must not be lost belongs in a real broker.
Why it was split out
It has nothing to do with leader election, and shipping a non-durable fan-out inside a package that promises leadership guarantees invited it to be mistaken for something it is not.
Options
| Option | Default | Meaning |
|---|---|---|
Retention |
5 min |
How long a message survives before the sweep deletes it. |
CleanupInterval |
1 min |
How often expired messages are swept. |
WatchTimeout |
1 min |
Long-poll timeout. Not a delivery delay — Consul answers as soon as something changes. |
Consul connection settings (Address, AclToken, Datacenter, ServiceName) come
from ConsulOptions, shared with the leadership package.
License
MIT
| 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
- Consul (>= 1.8.0)
- DLeader.Consul (>= 2.0.1)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.11)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.11)
- Microsoft.Extensions.Options (>= 10.0.11)
-
net8.0
- Consul (>= 1.8.0)
- DLeader.Consul (>= 2.0.1)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.2)
- Microsoft.Extensions.Logging.Abstractions (>= 8.0.3)
- Microsoft.Extensions.Options (>= 8.0.2)
-
net9.0
- Consul (>= 1.8.0)
- DLeader.Consul (>= 2.0.1)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 9.0.19)
- Microsoft.Extensions.Logging.Abstractions (>= 9.0.19)
- Microsoft.Extensions.Options (>= 9.0.19)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
See CHANGELOG.md