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

latest releases: v2.6.14, v2.6.12, v2.7.0-preview.8...
8 months ago

We're happy to announce a new NATS .NET release v2.5.16. This release fixes various bugs and introduces a couple of nice features: Socket Connection Factory (enables going through proxies, potentially for other interesting stuff too!) and Direct Request Reply (an internal library improvement). We also want to announce that we have stopped testing against .NET 6.0 although we are still targeting it.

What's Changed

Socket Connection Factory

Thanks to @wolfkor and @caleblloyd creating this abstraction, we now have a way of plugging in any implementation that could read and write buffers not just network sockets. Current use case is to enable going through forward proxies but we can't wait to see what other use cases are possible, perhaps can help with testing for example. (#826, #828)

public interface INatsSocketConnection : IAsyncDisposable
{
    ValueTask<int> SendAsync(ReadOnlyMemory<byte> buffer);
    ValueTask<int> ReceiveAsync(Memory<byte> buffer);
}

Direct Request Reply

We have received quite a few reports about JetStream publish and other operations timing out under certain scenarios. Even though we suspect at least in some of these cases there maybe a combination of mixing sync and async code leading to thread pool issues and current request reply implementation relying on a single muxed subscription channel potentially creating a bottleneck, we knew there was room for improvement. With this feature (which is not turned on by default) we are by passing the mux subscription channel and delivering replies directly (hence the name) which results in a performance boost of ~10% in response time and about 40% in reducing GC pressure. (#829)

var opts = new NatsOpts
{
    RequestReplyMode = NatsRequestReplyMode.Direct, // Disabled by default
};
await using var connection = new NatsConnection(opts);

Call for Testing

We invite you to test this new release in your applications with RequestReplyMode set to NatsRequestReplyMode.Direct. We’re particularly interested in feedback from developers who have experienced timeouts related to JetStream publishing.

New Contributors

Full Changelog: v2.5.15...v2.5.16

Download from NuGet

You can download the latest version from NuGet.

Don't miss a new nats.net release

NewReleases is sending notifications on new releases.