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
                    
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="DLeader.Consul.Messaging" Version="2.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="DLeader.Consul.Messaging" Version="2.0.1" />
                    
Directory.Packages.props
<PackageReference Include="DLeader.Consul.Messaging" />
                    
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 DLeader.Consul.Messaging --version 2.0.1
                    
#r "nuget: DLeader.Consul.Messaging, 2.0.1"
                    
#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 DLeader.Consul.Messaging@2.0.1
                    
#: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=DLeader.Consul.Messaging&version=2.0.1
                    
Install as a Cake Addin
#tool nuget:?package=DLeader.Consul.Messaging&version=2.0.1
                    
Install as a Cake Tool

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 SubscribeAsync completes — 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 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.

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
2.0.1 86 9/5/2026
2.0.0 91 9/4/2026

See CHANGELOG.md