Releases: nats-io/nats.net.v2
NATS .NET v2.2.1
This is a bug fix release for NATS .NET version 2.2.1, containing minor bug fixes. Please review the section below regarding the breaking change related to key validation in the key/value store.
What's Changed
- Make Build() on NatsBuilder Internal by @rickdotnet in #473
- Validate KV keys by @mtmk in #481
- Always use seed URLs when reconnecting by @caleblloyd , @mtmk in #482
Full Changelog: v2.2.0...v2.2.1
Breaking Change in Key/Value Store Key Validation
We have improved and added missing key validation for key/value store operations. However, your applications may break if you are using keys that contain characters not within the accepted range. Valid keys must match the pattern \A[-/_=.a-zA-Z0-9]+\z and cannot start or end with a period, as outlined in ADR-8.
- See also Issue #474
Nuget Package
dotnet add package NATS.Net --version 2.2.1
NATS .NET v2.2.0
This is a minor release of the NATS .NET version 2.2.0, featuring improvements to the TLS and Hosting APIs, along with various bug fixes. Please note that there are a few breaking changes; review the details below to determine if you are affected.
What's Changed
- Dispose fixes by @mtmk in #451
- Object store metadata fix by @niklasfp in #459
- Fix typo in update-docs.md by @codymullins in #462
- Deserialize empty payloads by @TheFourtyTwo in #455
- Update NATS.Client.Hosting package as NATS.Extensions.Microsoft.DependencyInjection by @rickdotnet in #433
- Add client certificate chain support and SSL context generation by @jmcrumb in #454
- add NatsTlsOpts.ConfigureClientAuthentication by @caleblloyd in #463
New Contributors
A warm welcome and thanks to @codymullins, @jmcrumb, and @TheFourtyTwo for their first contributions to the project.
Full Changelog: v2.1.4...v2.2.0
New Features and Breaking Changes
TLS Configuration Options API Improvements
With the advancements in .NET 8.0's TLS client APIs, we've made corresponding updates, especially concerning client certificates with intermediate CAs. Such certificates no longer need to be installed in the OS certificate stores. If you're directly loading the certificates from files, you won’t need to make any adjustments.
Additionally, when utilizing callback configuration mechanisms, be aware they will be invoked at every connection attempt, including reconnects. This provides an opportunity to dynamically update your certificates.
We are actively refining these TLS APIs, aiming for simplicity based on your feedback. Your patience and input are greatly valued as we continue this process.
A heartfelt thank you to @jmcrumb ❤️ for their significant contributions to these enhancements.
Hosting API Improvements
We've introduced a new dependency injection package, NATS.Extensions.Microsoft.DependencyInjection
, which brings new features, an improved API, and clearer naming conventions, setting the stage for future updates.
Users of the NATS.Client.Hosting
package will not face any breaking changes immediately. However, we encourage upgrading to the new package to leverage these enhancements. Please note that NATS.Client.Hosting
will eventually be deprecated.
A special thank you to @rickdotnet ❤️ for the excellent implementation, and to @mrpmorris ❤️ for the insightful package name suggestion, aiding particularly first-time NATS .NET application developers.
(see also #433)
Deserializer Design Fixes
We have resolved a design flaw where the deserializer was not activated for empty payloads, which led to a default value being automatically returned as the message data. With this fix, the deserializer will now be invoked for empty payloads as well, leaving the decision of what to return - be it a default value, an empty collection, or something else - up to the deserializer’s implementation.
For those using the existing default serializers, your applications should continue to function as they have previously.
If you have developed custom deserializers, it's important to review and test how your solution manages empty payloads to ensure it behaves as expected.
We extend our special thanks to @TheFourtyTwo ❤️ for highlighting this important issue.
(See also #455)
Nuget Package
dotnet add package NATS.Net --version 2.2.0
NATS .NET v2.1.4
This is a bug fix release version 2.1.4 of NATS .NET client library. Please also see the potentially breaking change below.
What's Changed
- Added OnNoData Async Func to NatsKVOpts by @darkwatchuk in #439
- Message error processing by @mtmk in #407
New Contributors
- @darkwatchuk made their first contribution in #439
Full Changelog: v2.1.3...v2.1.4
Breaking Change
Because of the way the serialization errors are handled after the change #407 you might see different behaviour in application where serialization errors were potentially not propagated or logged. With this change application code now can check if there were any serialization errors before processing the message:
// Also similar in JetStream consumers and Key/Value watchers
await foreach (var msg in nats.SubscribeAsync<MyEvent>("events.>"))
{
if (msg.Error != null)
{
// handle serialization error
}
else
{
// process message
}
}
Nuget Package
dotnet add package NATS.Net --version 2.1.4
NATS.Net v2.1.3
We're happy to announce version 2.1.3 of NATS.Net, which introduces experimental OpenTelemetry tracing for better diagnostics, plus bug fixes. Feedback on OTel tracing is appreciated.
What's Changed
- Experimental OpenTelemetry Core by @Cooksauce in #437
- Prevent KeyValueStore error when MaxAge is set below the default DuplicateWindow value by @rickdotnet in #362
- Implement Consumers Pause by @MauriceVanVeen in #432
- Ordered consumer start time fix by @mtmk in #424
- Added KV flow control by @mtmk in #430
New Contributors
- @MauriceVanVeen made their first contribution in #432
Full Changelog: v2.1.2...v2.1.3
Experimental OpenTelemetry Support
With this release, we are introducing experimental OTel tracing support in the core library. This means adjustments in how and where spans are named and generated may be necessary, for instance. Our goal is to ensure we can process your feedback and align with the rest of the NATS ecosystem effectively. Please give it a try; we greatly appreciate your feedback.
We want to thank @Cooksauce for implementing this feature, and especially @stebet and @martinjt for their support. Last but not least, we're grateful to @davidfowl for his support and encouragement.
Nuget Package
dotnet add package NATS.Net --version 2.1.3
NATS.Net v2.1.2
This is an important bug fix release NATS.Net v2.1.2 which resolves subscription queue group protocol error.
What's Changed
- Make sure queue group is written to wire by @MerzMax in #414
- Make INatsJSContextFactory public by @sgwong in #413
- Gracefully close sockets by @caleblloyd in #406
Full Changelog: v2.1.1...v2.1.2
Bug Fix Subscription Queue Group Protocol Error
There was a bug writing queue group name to wire since release v2.1.0 which is solved with this release. Please check #411 and #414 for more details. Huge thanks to @MerzMax finding the issue and supplying the fix.
Nuget Package
dotnet add package NATS.Net --version 2.1.2
NATS.Net v2.1.1
This is a bug fix release NATS.Net v2.1.1.
What's Changed
- Correct improper data types and refine data annotations by @aliasadidev in #397
- Replace the internal sha512 implementation with .Net built in sha512 by @niklasfp in #390
- Validate stream name parameters in JSContext methods. by @niklasfp in #379
- JetStream config JSON fixed by @mtmk in #394
- KV empty keys fix by @mtmk in #399
- Object store serialization fix by @mtmk in #405
- Use fetch no wait for empty streams by @mtmk in #401
New Contributors
- @aliasadidev made their first contribution in #397
Full Changelog: v2.1.0...v2.1.1
NATS.Net v2.1.0
We're excited to announce the release of NATS.Net v2.1.0. This version brings performance improvements, numerous fixes, and a few necessary breaking changes to enhance unit testing and async events:
- Send buffer performance improvements using I/O pipelines
- Enhanced interface accessibility for simplified unit testing
- Added capability for asynchronous event handling
- Support for keyed dependency injection
- And bug fixes
What's Changed
- Expose ReplyTo on NatsJSMsg by @rickdotnet in #314
- Suggested fixes to interfaces by @sspates in #297
- Use System.IO.Pipelines for sending by @caleblloyd in #303
- NatsSub cancellation token race fix by @mtmk in #325
- Object store name check fix by @mtmk in #327
- micro-optimizations in ProtocolWriter by @caleblloyd in #329
- Support Keyed DI services in .NET 8 by @rickdotnet in #331
- Nullability review for models by @mnmr in #332
- Addition of factories for better testability. by @sspates in #330
- Ordered consumer optimizations by @mtmk in #336
- TLS auth timeout by @mtmk in #339
- Log connection failure as warning by @jasper-d in #343
- pipe reader: don't mark commands as consumed until pending=0 by @caleblloyd in #347
- Async event handlers by @mnmr in #324
- Updated interface to include Async events. by @sspates in #353
- Fix unnecessary error log on dispose by @mtmk in #354
- Ping command as value task source by @mtmk in #358
- Added deliver_group to consumer config by @mtmk in #366
- Send buffer changes by @mtmk in #346
- Expose Headers on NatsSvcMsg by @niklasfp in #371
- Fix NatsSvcServer start time format so that it's no longer culture aware by @niklasfp in #374
- Reject payloads over the threshold set by server by @mtmk in #378
- Publish - avoid async state machine when possible by @caleblloyd in #373
- Send buffer fix by @mtmk in #380
- Buffer defaults avoiding LOH by @mtmk in #383
- Hosting keyed services fixes by @mtmk in #386
- Add nkey and sha512 micro benchmarks and sanity check tests by @niklasfp in #389
- Fixed base64 decode buffer size by @mtmk in #387
New Contributors
- @rickdotnet made their first contribution in #314
- @sspates made their first contribution in #297
- @mnmr made their first contribution in #332
- @niklasfp made their first contribution in #371
Full Changelog: v2.0.3...v2.1.0
Send Buffer Performance Improvements
Thanks to @caleblloyd's outstanding contributions and the awesome support from @to11mtm and @stebet, we've enhanced the send buffer's performance by utilizing IO pipelines, resulting in better memory usage and garbage collection efficiency.
v2.0.3
Method | Iter | Mean | Error | StdDev | Gen0 | Allocated |
---|---|---|---|---|---|---|
PublishAsync | 64 | 172.0 us | 26.54 us | 1.45 us | - | 803 B |
PublishAsync | 512 | 469.7 us | 25.64 us | 1.41 us | 0.9766 | 18061 B |
PublishAsync | 1024 | 684.6 us | 62.52 us | 3.43 us | 1.9531 | 37606 B |
v2.1.0
Method | Iter | Mean | Error | StdDev | Allocated |
---|---|---|---|---|---|
PublishAsync | 64 | 130.9 us | 17.24 us | 0.95 us | 380 B |
PublishAsync | 512 | 277.5 us | 10.69 us | 0.59 us | 381 B |
PublishAsync | 1024 | 444.9 us | 7.15 us | 0.39 us | 356 B |
Breaking Changes and Migration Guide
Event handlers
- Event handlers on connection object are now asynchronous and you would need to make code changes if you've been using them. Also one of the event's name has changed from 'OnError' to 'MessageDropped`:
nats.MessageDropped += async (_, e) =>
{
await File.AppendAllTextAsync("c:/tmp/log.txt", $"[DROP] {e.Subject}: {e.Data}\n");
};
- The way the events are dispatched has also changed to use a channel hence there maybe a delay receiving the event in your handlers.
See #324 for more details.
Other minor breaking changes
- Nullability review for models changed quite a few of the (mainly) JetStream model classes for better compiler support and developer experience. (#332)
- If you're relying on log severity on reconnect messages please check #343 for details as
Failed to connect NATS {Url}
messages are now logged as warnings instead of errors.
Thank you
Also a huge thanks to our contributors and community for their amazing work and support! 🙏
Join our community chat rooms if you have any questions either on slack.nats.io dotnet channel or here on GitHub!
Don't forget to check out the documentation for guides and examples.
Additionally check out NATS by example - An evolving collection of runnable, cross-client reference examples for NATS.
Happy coding! ❤️
Nuget Packages
NATS.Net
This is the main meta package containing all other packages except serialization.
dotnet add package NATS.Net --version 2.1.0
If you are not deploying Native AOT you can also use ad-hoc JSON serialization:
dotnet add package NATS.Client.Serializers.Json --version 2.1.0
Individual Packages
dotnet add package NATS.Client.Core --version 2.1.0
dotnet add package NATS.Client.Hosting --version 2.1.0
dotnet add package NATS.Client.JetStream --version 2.1.0
dotnet add package NATS.Client.KeyValueStore --version 2.1.0
dotnet add package NATS.Client.ObjectStore --version 2.1.0
dotnet add package NATS.Client.Services --version 2.1.0
dotnet add package NATS.Client.Serializers.Json --version 2.1.0
NATS.Net v2.1.0-preview.6
This is a NATS.Net preview release version 2.1.0-preview.6 with minor updates.
What's Changed
- Ping command as value task source by @mtmk in #358
- Added deliver_group to consumer config by @mtmk in #366
- Send buffer changes by @mtmk, @caleblloyd in #346
Full Changelog: v2.1.0-preview.5...v2.1.0-preview.6
Thank you
Special thanks to @caleblloyd, @to11mtm and @stebet for their help with #346 and #358
Also a huge thanks to our contributors and community for their amazing work and support! 🙏
Happy coding! ❤️
Nuget Packages
NATS.Net
This is the main meta package containing all other packages except serialization.
dotnet add package NATS.Net --version 2.1.0-preview.6
If you are not deploying Native AOT you can also use ad-hoc JSON serialization:
dotnet add package NATS.Client.Serializers.Json --version 2.1.0-preview.6
Individual Packages
dotnet add package NATS.Client.Core --version 2.1.0-preview.6
dotnet add package NATS.Client.Hosting --version 2.1.0-preview.6
dotnet add package NATS.Client.JetStream --version 2.1.0-preview.6
dotnet add package NATS.Client.KeyValueStore --version 2.1.0-preview.6
dotnet add package NATS.Client.ObjectStore --version 2.1.0-preview.6
dotnet add package NATS.Client.Services --version 2.1.0-preview.6
dotnet add package NATS.Client.Serializers.Json --version 2.1.0-preview.6
NATS.Net v2.1.0-preview.5
This is another NATS.Net preview release version 2.1.0-preview.5 with minor updates.
What's Changed
- Updated interface to include Async events. by @sspates in #353
- Fix unnecessary error log on dispose by @mtmk in #354
Full Changelog: v2.1.0-preview.4...v2.1.0-preview.5
Thank you
A huge thanks to our contributors for their amazing work and support! 🙏
Happy coding! ❤️
Nuget Packages
NATS.Net
This is the main meta package containing all other packages except serialization.
dotnet add package NATS.Net --version 2.1.0-preview.5
If you are not deploying Native AOT you can also use ad-hoc JSON serialization:
dotnet add package NATS.Client.Serializers.Json --version 2.1.0-preview.5
Individual Packages
dotnet add package NATS.Client.Core --version 2.1.0-preview.5
dotnet add package NATS.Client.Hosting --version 2.1.0-preview.5
dotnet add package NATS.Client.JetStream --version 2.1.0-preview.5
dotnet add package NATS.Client.KeyValueStore --version 2.1.0-preview.5
dotnet add package NATS.Client.ObjectStore --version 2.1.0-preview.5
dotnet add package NATS.Client.Services --version 2.1.0-preview.5
dotnet add package NATS.Client.Serializers.Json --version 2.1.0-preview.5
NATS.Net v2.1.0-preview.4
This is a NATS.Net bug fix release version 2.1.0-preview.4.
What's Changed
- Support Keyed DI services in .NET 8 by @rickdotnet in #331
- Nullability review for models by @mnmr in #332
- Addition of factories for better testability. by @sspates in #330
- Ordered consumer optimizations by @mtmk in #336
- TLS auth timeout by @mtmk in #339
- Log connection failure as warning by @jasper-d in #343
- pipe reader: don't mark commands as consumed until pending=0 by @caleblloyd in #347
- Async event handlers by @mnmr in #324
New Contributors
Full Changelog: v2.1.0-preview.2...v2.1.0-preview.4
Breaking changes
Event handlers
- Event handlers on connection object are now asynchronous and you would need to make code changes if you've been using them. Also one of the event's name has changed from 'OnError' to 'MessageDropped`:
nats.MessageDropped += async (_, e) =>
{
await File.AppendAllTextAsync("c:/tmp/log.txt", $"[DROP] {e.Subject}: {e.Data}\n");
};
- The way the events are dispatched has also changed to use a channel hence there maybe a delay receiving the event in your handlers.
See #324 for more details.
Other minor breaking changes
- Nullability review for models changed quite a few of the (mainly) JetStream model classes for better compiler support and developer experience. (#332)
- If you're relying on log severity on reconnect messages please check #343 for details as
Failed to connect NATS {Url}
messages are now logged as warnings instead of errors.
Note about release 2.1.0-preview.3
You might've notice we skipped announcing perview.3 release because of an issue (#341) we discovered which has now been fixed in #347 thanks to @caleblloyd.
Thank you
Big thanks to our contributors 🙏
Join our community chat rooms if you have any questions either on slack.nats.io dotnet channel or here on GitHub!
Don't forget to check out the documentation for guides and examples.
Additionally check out NATS by example - An evolving collection of runnable, cross-client reference examples for NATS.
Happy coding! ❤️
Nuget Packages
NATS.Net
This is the main meta package containing all other packages except serialization.
dotnet add package NATS.Net --version 2.1.0-preview.4
If you are not deploying Native AOT you can also use ad-hoc JSON serialization:
dotnet add package NATS.Client.Serializers.Json --version 2.1.0-preview.4
Individual Packages
dotnet add package NATS.Client.Core --version 2.1.0-preview.4
dotnet add package NATS.Client.Hosting --version 2.1.0-preview.4
dotnet add package NATS.Client.JetStream --version 2.1.0-preview.4
dotnet add package NATS.Client.KeyValueStore --version 2.1.0-preview.4
dotnet add package NATS.Client.ObjectStore --version 2.1.0-preview.4
dotnet add package NATS.Client.Services --version 2.1.0-preview.4
dotnet add package NATS.Client.Serializers.Json --version 2.1.0-preview.4