![]() |
VOOZH | about |
dotnet add package NATS.Extensions.Microsoft.DependencyInjection --version 2.8.2
NuGet\Install-Package NATS.Extensions.Microsoft.DependencyInjection -Version 2.8.2
<PackageReference Include="NATS.Extensions.Microsoft.DependencyInjection" Version="2.8.2" />
<PackageVersion Include="NATS.Extensions.Microsoft.DependencyInjection" Version="2.8.2" />Directory.Packages.props
<PackageReference Include="NATS.Extensions.Microsoft.DependencyInjection" />Project file
paket add NATS.Extensions.Microsoft.DependencyInjection --version 2.8.2
#r "nuget: NATS.Extensions.Microsoft.DependencyInjection, 2.8.2"
#:package NATS.Extensions.Microsoft.DependencyInjection@2.8.2
#addin nuget:?package=NATS.Extensions.Microsoft.DependencyInjection&version=2.8.2Install as a Cake Addin
#tool nuget:?package=NATS.Extensions.Microsoft.DependencyInjection&version=2.8.2Install as a Cake Tool
π License Apache 2.0
π NuGet
π Doc
π Test Linux
π Test Windows
π Slack
NATS .NET is the .NET client for NATS, a distributed messaging system. It provides pub/sub and request/reply (Core NATS), streaming and persistence (JetStream), Key-Value Store, Object Store, and Services.
Additionally check out NATS by example - An evolving collection of runnable, cross-client reference examples for NATS.
Start a NATS server:
docker run -p 4222:4222 nats
Create a subscriber app:
dotnet new console -n Sub && cd Sub && dotnet add package NATS.Net
using NATS.Net;
await using var nc = new NatsClient();
await foreach (var msg in nc.SubscribeAsync<string>("greet"))
Console.WriteLine($"Received: {msg.Data}");
In another terminal, create a publisher app:
dotnet new console -n Pub && cd Pub && dotnet add package NATS.Net
using NATS.Net;
await using var nc = new NatsClient();
await nc.PublishAsync("greet", "Hello, NATS!");
using NATS.Net;
await using var nc = new NatsClient();
// Publish a message
await nc.PublishAsync("orders.new", new Order(Id: 1, Item: "widget"));
// Subscribe with async enumerable
await foreach (var msg in nc.SubscribeAsync<Order>("orders.>"))
Console.WriteLine($"Received order: {msg.Data}");
// Request-reply
var order = new Order(Id: 2, Item: "gadget");
var reply = await nc.RequestAsync<Order, Confirmation>("orders.create", order);
// JetStream (persistent messaging)
var js = nc.CreateJetStreamContext();
// Key/Value Store
var kv = nc.CreateKeyValueStoreContext();
// Object Store
var obj = nc.CreateObjectStoreContext();
// Services
var svc = nc.CreateServicesContext();
We are not testing with .NET 6.0 target anymore even though it is still targeted by the library. This is to reduce the number of test runs and speed up the CI process as well as to prepare for the next major version, possibly dropping .NET 6.0 support.
Don't confuse NuGet packages!
NATS .NET package on NuGet is called NATS.Net.
There is another package called NATS.Client which is the older version of the client library
and will be deprecated eventually.
NATS .NET now supports .NET Standard 2.0 and 2.1 along with .NET 6.0 and 8.0, which means you can also use it with .NET Framework 4.6.2+ and Unity 2018.1+.
NATS is a high-performance, secure, distributed messaging system. It's a connective technology tailored for modern distributed systems, facilitating efficient addressing, discovery, and message exchange. It supports dynamic service and stream processing across various locations and devices, enhancing mobility, security, and independence from traditional constraints such as DNS.
Head over to NATS documentation for more information.
NATS client functionality is split across two layers: the core client
(NATS.Net, this repo) and Orbit,
a separate set of packages with higher-level utilities.
The split exists so the core can stay small, stable, and consistent across NATS clients in every language, while Orbit can iterate quickly on opinionated abstractions without dragging the core API along for the ride.
NATS.Net)nats-server.orbit.net)| Concern | Core (NATS.Net) |
Orbit |
|---|---|---|
| Connect, publish, subscribe, request/reply | β | |
| JetStream publish, consumers, streams, KV, OS | β | |
| Service API (request/reply micro-services) | β | |
| Wire-protocol coverage, auth, TLS, reconnection | β | |
| Cross-client parity, conservative semver | β | |
| Opinionated helpers / sugar over core APIs | β | |
| New experimental patterns (e.g. partitioned groups) | β | |
| KV codecs, distributed counters, NATS contexts | β | |
| .NET-idiomatic abstractions with no parity mandate | β | |
| Per-utility versioning, faster API churn allowed | β |
Rule of thumb: if it is a thin mapping of something
nats-serveralready speaks and every official client must expose it, it belongs in core. If it is a pattern, helper, or abstraction layered on top, it belongs in Orbit.
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Application code β
ββββββββββββββββ¬ββββββββββββββββββββββββββββ¬ββββββββββββ
β β
βΌ βΌ
βββββββββββββββββββββ βββββββββββββββββββββ
β Orbit packages β uses β NATS.Net (core) β
β (opinionated, ββββββββΆβ (parity, stable, β
β per-pkg semver) β β protocol-level) β
βββββββββββββββββββββ βββββββββββ¬ββββββββββ
β
βΌ
βββββββββββββββ
β nats-server β
βββββββββββββββ
You are welcome to contribute to this project. Here are some steps to get you started:
You can report bugs and request features by opening an issue on GitHub.
You can join the community asking questions, sharing ideas, and helping others:
#dotnet channelPlease make sure to sign your commits. All commits must be signed before a Pull Request can be merged.
NATS.Net.slnx solution in Visual Studio, Rider or VS Code (or any other editor of your choice)NATS.Client.Platform.Windows.Tests which is a subset of tests that should pass on WindowsNATS.Client.CoreUnit.Tests and NATS.Client.Core2.Tests which are more stabledotnet format at root directory of project to clear warnings that can be auto-formatteddotnet build at root directory and make sure there are no errors or warningsPlease also check out the and .
This library is based on the excellent work in Cysharp/AlterNats
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 net5.0 was computed. net5.0-windows net5.0-windows was computed. net6.0 net6.0 is compatible. net6.0-android net6.0-android was computed. net6.0-ios net6.0-ios was computed. net6.0-maccatalyst net6.0-maccatalyst was computed. net6.0-macos net6.0-macos was computed. net6.0-tvos net6.0-tvos was computed. net6.0-windows net6.0-windows was computed. net7.0 net7.0 was computed. net7.0-android net7.0-android was computed. net7.0-ios net7.0-ios was computed. net7.0-maccatalyst net7.0-maccatalyst was computed. net7.0-macos net7.0-macos was computed. net7.0-tvos net7.0-tvos was computed. net7.0-windows net7.0-windows was computed. net8.0 net8.0 is compatible. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 was computed. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 was computed. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 netcoreapp2.0 was computed. netcoreapp2.1 netcoreapp2.1 was computed. netcoreapp2.2 netcoreapp2.2 was computed. netcoreapp3.0 netcoreapp3.0 was computed. netcoreapp3.1 netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 netstandard2.0 is compatible. netstandard2.1 netstandard2.1 is compatible. |
| .NET Framework | net461 net461 was computed. net462 net462 was computed. net463 net463 was computed. net47 net47 was computed. net471 net471 was computed. net472 net472 was computed. net48 net48 was computed. net481 net481 was computed. |
| MonoAndroid | monoandroid monoandroid was computed. |
| MonoMac | monomac monomac was computed. |
| MonoTouch | monotouch monotouch was computed. |
| Tizen | tizen40 tizen40 was computed. tizen60 tizen60 was computed. |
| Xamarin.iOS | xamarinios xamarinios was computed. |
| Xamarin.Mac | xamarinmac xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos xamarinwatchos was computed. |
Showing the top 3 NuGet packages that depend on NATS.Extensions.Microsoft.DependencyInjection:
| Package | Downloads |
|---|---|
|
NATS.Net
NATS .NET client for the NATS cloud-native messaging system. Includes Core NATS pub/sub, JetStream persistent messaging, Key/Value Store, Object Store, and Services. Built on async/await with support for .NET 8, .NET 6, and .NET Standard 2.0/2.1. |
|
|
Talverse.NotificationService
A complete solution for sending notifications |
|
|
EasyNats.DependencyInjection
Package Description |
Showing the top 1 popular GitHub repositories that depend on NATS.Extensions.Microsoft.DependencyInjection:
| Repository | Stars |
|---|---|
|
ChilliCream/graphql-platform
Welcome to the home of the Hot Chocolate GraphQL server for .NET, the Strawberry Shake GraphQL client for .NET and Nitro the awesome Monaco based GraphQL IDE.
|
| Version | Downloads | Last Updated |
|---|---|---|
| 3.0.0-preview.10 | 49 | 6/17/2026 |
| 3.0.0-preview.9 | 122 | 6/15/2026 |
| 3.0.0-preview.8 | 504 | 6/1/2026 |
| 3.0.0-preview.7 | 107 | 5/28/2026 |
| 3.0.0-preview.6 | 350 | 5/14/2026 |
| 3.0.0-preview.5 | 165 | 5/7/2026 |
| 3.0.0-preview.4 | 1,106 | 5/1/2026 |
| 3.0.0-preview.3 | 1,777 | 4/17/2026 |
| 3.0.0-preview.2 | 2,483 | 3/13/2026 |
| 3.0.0-preview.1 | 362 | 2/18/2026 |
| 2.8.2 | 190 | 6/17/2026 |
| 2.8.1 | 7,056 | 5/28/2026 |
| 2.8.0 | 5,395 | 5/13/2026 |
| 2.8.0-preview.3 | 54 | 5/6/2026 |
| 2.8.0-preview.2 | 67 | 5/1/2026 |
| 2.8.0-preview.1 | 67 | 4/16/2026 |
| 2.7.3 | 31,226 | 3/13/2026 |
| 2.7.2 | 40,900 | 2/10/2026 |
| 2.7.2-preview.2 | 79 | 1/30/2026 |
| 2.7.2-preview.1 | 83 | 1/14/2026 |