MyNatsClient 0.14.1

Provides a simple, effective sync and async library for interacting with NATS Server using .NET and .NET Core. It uses IObservable so it is ReactiveX (RX) friendly.

There is a newer version of this package available.
See the version list below for details.
Install-Package MyNatsClient -Version 0.14.1
dotnet add package MyNatsClient --version 0.14.1
<PackageReference Include="MyNatsClient" Version="0.14.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add MyNatsClient --version 0.14.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: MyNatsClient, 0.14.1"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install MyNatsClient as a Cake Addin
#addin nuget:?package=MyNatsClient&version=0.14.1

// Install MyNatsClient as a Cake Tool
#tool nuget:?package=MyNatsClient&version=0.14.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Pub-Sub sample

Simple pub-sub sample showing one client that publishes and one that subscribes. This can of course be the same client and you can also have more clients subscribing etc.

Publisher

var cnInfo = new ConnectionInfo("192.168.1.10");
var client = new NatsClient(cnInfo);

await client.ConnectAsync();

await client.PubAsync("tick", GetNextTick());

//or using an encoding package e.g. Json
await client.PubAsJsonAsync("tickItem", new Tick { Value = GetNextTick() });

Subscriber

var cnInfo = new ConnectionInfo("192.168.1.10");
var client = new NatsClient(cnInfo);

await _client.ConnectAsync();

await client.SubAsync("tick", stream => stream.Subscribe(msg => {
    Console.WriteLine($"Clock ticked. Tick is {msg.GetPayloadAsString()}");
}));

//or using an encoding package e.g Json
await client.SubAsync("tickItem", stream => stream.Subscribe(msg => {
    Console.WriteLine($"Clock ticked. Tick is {msg.FromJson<TestItem>().Value}");
}))

Pub-Sub sample

Simple pub-sub sample showing one client that publishes and one that subscribes. This can of course be the same client and you can also have more clients subscribing etc.

Publisher

var cnInfo = new ConnectionInfo("192.168.1.10");
var client = new NatsClient(cnInfo);

await client.ConnectAsync();

await client.PubAsync("tick", GetNextTick());

//or using an encoding package e.g. Json
await client.PubAsJsonAsync("tickItem", new Tick { Value = GetNextTick() });

Subscriber

var cnInfo = new ConnectionInfo("192.168.1.10");
var client = new NatsClient(cnInfo);

await _client.ConnectAsync();

await client.SubAsync("tick", stream => stream.Subscribe(msg => {
    Console.WriteLine($"Clock ticked. Tick is {msg.GetPayloadAsString()}");
}));

//or using an encoding package e.g Json
await client.SubAsync("tickItem", stream => stream.Subscribe(msg => {
    Console.WriteLine($"Clock ticked. Tick is {msg.FromJson<TestItem>().Value}");
}))

Release Notes

https://github.com/danielwertheim/mynatsclient/releases

NuGet packages (6)

Showing the top 5 NuGet packages that depend on MyNatsClient:

Package Downloads
MyNatsClient.Rx
Convenience package that installs MyNatsClient and ReactiveExtensions (System.Reactive). MyNatsClient, provides a simple, effective sync and async library for interacting with NATS Server using .NET and .NET Core. It uses IObservable so it is ReactiveX (RX) friendly.
MyNatsClient.Encodings.Json
JSON Encoding for assisting with sending and consuming JSON messages using MyNatsClient which provides a simple, effective sync and async library for interacting with NATS Server. It uses IObservable so it is ReactiveX (RX) friendly.
MyNatsClient.Encodings.Protobuf
Protobuf Encoding for assisting with sending and consuming Protobuf messages using MyNatsClient which provides a simple, effective sync and async library for interacting with NATS Server using. It uses IObservable so it is ReactiveX (RX) friendly.
Serilog.Sinks.Nats
Serilog sink for NATS messaging server
Mi.Fx.Nats
macula.io Nats abstraction

GitHub repositories (1)

Showing the top 1 popular GitHub repositories that depend on MyNatsClient:

Repository Stars
GB28181/GB28181.Solution
Linux/Win/Docker/kubernetes/Chart/Kustomize/GB28181/SIP/RTP/SDP/WebRTC/作为上下级域/平台级联互联

Version History

Version Downloads Last updated
0.19.1 778 5/15/2021
0.19.0 88 5/13/2021
0.18.2 2,085 3/18/2021
0.18.1 286 3/11/2021
0.18.0 118 3/10/2021
0.17.1 124 3/9/2021
0.17.0 2,249 10/16/2020
0.16.1 831 9/19/2020
0.16.0 288 9/19/2020
0.15.0 315 9/19/2020
0.14.3 1,112 8/25/2020
0.14.2 279 8/16/2020
0.14.1 14,432 1/6/2020
0.13.0 64,890 6/29/2018
0.12.0 653 6/29/2018
0.12.0-pre1 780 5/4/2018
0.11.0 41,116 1/26/2017
0.10.0 21,910 1/10/2017
0.8.0 828 1/4/2017
0.7.0 996 12/23/2016
0.6.0 781 12/4/2016
0.5.1 848 10/18/2016
0.5.0 747 10/17/2016
0.4.0 803 10/16/2016
0.3.0 1,107 10/8/2016
0.3.0-b1 971 10/6/2016
0.2.1 834 6/14/2016
0.1.2 665 6/12/2016
Show less