We are excited to announce a minor release of NATS .NET version 2.7.0 with a lot of fixes and improvements making NATS .NET client easier to use, testing friendly and more robust:
- Improved OpenTelemetry support: Added filtering and enrichment for activities (#859)
- JetStream publish improvements: Better retry defaults and consistent error handling
- Dependency upgrades: All Microsoft.Extensions packages updated to .NET 8 (improves compatibility, security, and performance)
- Abstractions package: Moved serialization interface into abstractions (#858) for better modularity/ We will move other interfaces to Abstractions gradually.
Important: Please note, there are also minor breaking changes which might affect dependent applications and sometimes transient dependencies. Application developers should recompile and test their application more rigorously in a non-production environment before deploying to production.
Breaking Changes
-
Timeout exceptions: Replaced OperationCanceledException with NatsTimeoutException for timeouts (previously surfaced as cancellations). Update any code catching OperationCanceledException for timeouts.
-
ReplyAsync on NatsJsMsg: Now marked [Obsolete]. Use the alternative method instead.
-
Serialization interface moved into abstractions: Via PR #858 ("Move Serialization Interface into Abstractions").
- This is a structural refactor that relocates the serialization-related interface to a dedicated abstractions layer in the codebase.
- Why it matters: It improves modularity, maintainability, and separation of concerns (e.g., making it easier to swap or extend serialization without touching core implementation).
- Impact: This is not a breaking change for end-users (no API surface change is mentioned), but it could affect anyone building extensions or custom serializers that directly reference the old location.
- Linked issue: #851
-
Fixed KV TTL interface handling (#854): This brings KV API inline with the design documents. It removed TTL parameters from update calls, which are problematic with buckets with history enabled.
New Features
- OpenTelemetry activity filtering & enrichment
- Improved JetStream publish retry behavior
Bug Fixes
- Fixed KV TTL interface handling (#854)
- Fixed connection state issues for consume, request, and reply (#856–858)
- Improved timeout exception handling across client, JetStream, and consumer scenarios
What's Changed - Full List
- PeerInfo.Lag is wrong type by @darkwatchuk in #1021
- Replace deprecated IndexRange package with Microsoft.Bcl.Memory to solve possible dependency conflicts (for netFramework/netStandard2.0) by @FelixDamrau in #1009
- Replace
OperationCanceledExceptionwithNatsTimeoutExceptionby @ealeykin in #1022 - (Merge Branch) Release 2.7 (#874)
- Update INatsJsConsumer to return INatsJsMsg (#1004) by @paagamelo2
- Fix connection state for consume (#959) by @NicholasTNG
- Fix Ad-Hoc JSON Serializer to use Default Options (#984) by @philfontaine
- fix: handle 408 Requests Pending responses for fetch requests (#973) by @aradalvand
- Fix publish 503 test (#958) by @mtmk
- Fix JetStream publish retry defaults (#939) by @mtmk
- Fix kv ttl interface (#909) by @mtmk
- chore: rework NatsOpt.Default initialization (#921) by @regnrat
- fix:
NatsJSConsumernever disposing receive activities (#911) by @aradalvand - fix:
NatsInstrumentationOptions.Defaultgets reset each time (#907) by @aradalvand - #851 Move Serialization Interface into Abstractions (#858) by @thompson-tomo
- Obsolete ReplyAsync method for NatsJsMsg (#839) by @yeongjonglim
- Add support for
FilterandEnrichfor OpenTelemetry activities (#859) by @aradalvand - #848 Tweak dependencies (#853) by @thompson-tomo
- #863 Fix naming of consumer group attribute (#870) by @thompson-tomo
New Contributors
- @FelixDamrau made their first contribution in #1009
Full Changelog: v2.6.14...v2.7.0
You can download the built packages from NuGet as usual: https://www.nuget.org/packages/NATS.Net/2.7.0
Last but not least, we thank all the contributors for taking the time to help out and making NATS .NET a great community project for the NATS ecosystem and the community. Thank you ❤️