github nats-io/nats.net v2.5.0
NATS .NET v2.5.0

latest releases: v2.5.4, v2.5.3, v2.5.2...
one month ago

We're happy to announce a new release of NATS .NET version 2.5.0 with new NatsClient extensions. With this release we are completing the features required for a simplified client initialization for ease of use especially for newcomers.

New Features

  • Add JetStream NATS Client Extensions by @mtmk in #598
  • Add other client extensions by @mtmk in #637

New extensions to INatsClient enables context creation easily.

using NATS.Net;

await using var nc = new NatsClient();

// Serializer does the expected thing with all types
await nc.PublishAsync("x.int", 100);
await nc.PublishAsync("x.string", "Hello, World!");
await nc.PublishAsync("x.bytes", new byte[] { 65, 66, 67 });
await nc.PublishAsync("x.json", new MyData(30, "bar"));

// ...and now you can create the contexts from the client
var js = nc.CreateJetStreamContext();
var kv = nc.CreateKeyValueStoreContext();
var obj = nc.CreateObjectStoreContext();
var svc = nc.CreateServicesContext();

Contexts are also refactored to accept interfaces rather than implementations (see breaking changes below)

  • Added Domain support for stream mirroring and sourcing and KV full support for the same. by @darkwatchuk in #631

With this addition you can now setup your KV stores with mirroring support. We still have a bit more work to do with #642 to add domains.

Fixes

  • Run core tests on Windows and test run stability by @mtmk in #464
  • Adds type-forwarders NET 5.0+ by @VaticanUK in #641
  • Add placement configuration to key-value and object store by @mtmk in #650

Security

  • Bump System.Text.Json from 8.0.4 to 8.0.5 in /src/NATS.Client.Core by @dependabot in #649

Breaking Changes

Contexts now take interfaces instead of implementations. This helps us with creating various extensions as well as making it easier to unit test application code:

- public NatsJSContext(NatsConnection connection)
+ public NatsJSContext(INatsConnection connection)

- public NatsKVContext(NatsJSContext context)
+ public NatsKVContext(INatsJSContext context)

- public NatsObjContext(NatsJSContext context)
+ public NatsObjContext(INatsJSContext context)

- public NatsSvcContext(NatsConnection nats)
+ public NatsSvcContext(INatsConnection nats)

Code should compile without any issues but we're probably braking binary compatibility and you might want to refactor your code if you were working around the fact these constructors were not using interfaces.

New Contributors

Thank You

A big thank you to our contributors.

Happy coding ❤️

Full Changelog: v2.4.0...v2.5.0

Don't miss a new nats.net release

NewReleases is sending notifications on new releases.