Skip to content

Releases: nats-io/nats.go

Release v1.14.0

08 Apr 20:27
1714729
Compare
Choose a tag to compare

Changelog

JetStream and KeyValue users

Please see the "Changed" section for important (possibly breaking) changes compared to the previous version.

Experimental

The ObjectStore is still experimental and subject to change.

Added

  • JetStream:
    • Support for tracing API calls (#849, #911)
    • Error ErrMsgAlreadyAckd for a more detailed error when trying to acknowledge a message that already was. Thanks to @Berreek for the contribution (#862)
    • Made js.Subscribe() calls context aware (#872)
    • UpdateConsumer() and new consumer configuration options: MaxRequestBatch, MaxRequestExpires and InactiveThreshold (#893)
    • NakWithDelay() new acknowledgment call, and BackOff list of duration in the ConsumerConfig object (#894)
    • BackOff() subscription option. Thanks to @mfaizanse for the contribution (#933)
    • StallWait() publish option. This is the wait time (default is 200ms) that the library will wait when reaching the maximum inflight number of asynchronous publish calls (#941)
  • KeyValue:
    • Status functionality (#845)
    • MetaOnly() watcher option (#854)
    • GetRevision() to get the key at a specific revision, or ErrKeyNotFound if the key does not exist or not at the expected revision. Thanks to @boxboatmatt for the contribution (#903)
    • Placement in the KeyValueConfig structure (#929)
    • Expose nats.Context() option for the nats.KeyWatcher interface. Thanks to @boxboatmatt for the contribution (#904)
  • ObjectStore:
    • Status functionality (#845)
    • Placement in the ObjectStoreConfig structure (#929)
  • ConnectedUrlRedacted() a redacted version of ConnectedUrl() (#923)

Changed

  • JetStream:
    • The library no longer sets a default MaxAckPending when creating a JetStream consumer on Subscribe(). The selection of the value is left for the server to pick (#920)
    • The library will now try to resend a message when getting a ErrNoResponders error on a Publish() or StreamInfo() call. This is to overcome "blips" that may happen during leader changes. The action will be retried up to 2 times with a 250ms wait in between. These can be changed with the new publish options RetryWait() and RetryAttempts() (#930)
    • PublishMsgAsync() will now be limited to 4,000 maximum asynchronous publish calls inflight, if no maximum has been specified with PublishAsyncMaxPending() option.
  • KeyValue:
    • Delete() and Purge() now accept optional DeleteOpt options. The option available is LastRevision() which allows the purge or delete to be conditional to the last revision be equal to the last revision value, otherwise the operation will fail. Thanks to @steveh for the contribution (#856)
    • PurgeDeletes() will now keep markers that are less than 30 minutes by default. Also, PurgeDeletes() now accepts optional PurgeOpt values, not WatchOpt. The new DeleteMarkersOlderThan() option can be provided to change the default 30 minutes. A negative value will remove markers, regardless of their age (#906)
    • When connecting to a v2.7.2+ server, the stream for the KeyValue should be created with DiscardNew instead of DiscardOld. The library will now automatically update an existing stream for a KeyValue from DiscardOld to DiscardNew (#917)

Improved

  • Websocket:
    • Use 80 or 443 as default ports, depending on the scheme ws:// or wss://. Thanks to @cbrake for the suggestion (#879)
  • The connect failure error message when given an invalid user credentials file (#916)
  • The library will now auto-reconnect when the connection is closed on maximum connections reached from server, which could happen after a configuration reload. The library would previously have caused the connection to be permanently closed (#935)

Updated

  • Examples:
    • The Nats-echo service example to simulate a status request (#950)
    • Comment for the demo servers. Removed the TLS specific version since one can connect with TLS or not to the same port (#952)

Fixed

  • Documentation:
    • Typo in Bind go documentation. Thanks to @caspervonb for the contribution (#860)
    • Typo in SetClosedHandler. Thanks to @tormoder for the contribution (#877)
    • Typo in example_test.go. Thanks to @bvwells for the contribution (#882)
    • Comment for Subscribe method. Thanks to @ipromax for the contribution (#886)
    • Many API calls where not checking that stream and consumer names were valid, that is, did not contain a . in their name. This resulted in situations where the API would timeout because the server did not have interest on the malformed subject. Thanks to @sata-form3 for the report (#947)
  • JetStream:
    • Ordered consumers handling of auto unsubscribe (#847)
    • Activity check to handle cases when subscription was closed. Thanks to @boxboatmatt for the contribution (#873)
    • Return ErrStreamNotFound when calling AddConsumer against a missing stream (#881)
    • Prefix the error returned by StreamInfo() with nats: to match ConsumerInfo() (#928)
  • KeyValue:
    • Ensure Get() returns a nil and ErrKeyNotFound as per specification (#844)
    • Various issues, such as cancel of the context would not all the range on w.Updates() to exit, flow control, etc.. (#900, #901)
    • Use of the APIPrefix to work correctly across accounts (#910)
  • Websocket:
    • When using secure connection wss:// and a host name that resolves to multiple IPs, or when trying to reconnect to discovered servers, the (re)connection would fail with websocket invalid connection (#915)
    • Deadlock on authentication failure that manifested by a Connect() hanging forever. Thanks to @wenerme for the report (#926)

Complete Changes

v1.13.0...v1.14.0

Release v1.13.0

07 Oct 23:36
41cb5bc
Compare
Choose a tag to compare

Changelog

JetStream users

Please review release notes from v1.12.0 regarding important changes if upgrading from an earlier release.

Experimental

This release introduces KeyValue and ObjectStore as experimental features. Note that their APIs are subject to change based on community feedback. Also, some features will not work unless using NATS Server from the main branch, or the version following the latest public release v2.6.1.

Added

  • JetStream:
    • HeadersOnly() subscription option to only deliver headers but not the message payloads (#832)
    • Sealed, DenyDelete, DenyPurge and AllowRollup stream configuration options (#832)
    • GetLastMsg() retrieves the last raw stream message stored in JetStream by subject (#832)
  • KeyValue and ObjectStore (#832)
  • ConnectedServerVersion() returns the server's version string, or empty if not currently connected to a server (#832)

Fixed

  • JetStream:
    • Flow control may stall in some conditions (#837)
    • Context usage for Fetch() and Ack(). Thanks to @andreib1 and @T-J-L for the reports (#838)
    • Queue name cannot contain "." character when used as the durable name. Thanks to @saschahagedorn-f3 for the report (#841)
    • PublishMsgAsync would fail if a message reply was already set (#832)

Complete Changes

v1.12.2...v1.13.0

Release v1.12.3

21 Sep 19:22
4a0ad2a
Compare
Choose a tag to compare

Changelog

JetStream users

Please review release notes from v1.12.0 regarding important changes if upgrading from an earlier release.

Fixed

  • JetStream:
    • Received message may have wrong subject. This is a regression due to an attempt to reduce subject string copy in v1.12.2 (#827)

Complete Changes

v1.12.2...v1.12.3

Release v1.12.2

20 Sep 22:07
10daedc
Compare
Choose a tag to compare

Changelog

JetStream users

Please review release notes from v1.12.0 regarding important changes if upgrading from an earlier release.

Updated

  • JetStream:
    • Go doc for subscription calls in the interface (#818)

Improved

  • Reduce memory allocation for inbound messages. Thanks to @moredure for the contribution (#824)

Fixed

  • JetStream:
    • Unblock Pull Subscribe requests on a 408 with at least a message already fetched (#823)
  • Websocket:
    • Possible panic when decoding CLOSE frame. Thanks to @byazrail for the report (#821)

Complete Changes

v1.12.1...v1.12.2

Release v1.12.1

03 Sep 22:22
42edba4
Compare
Choose a tag to compare

Changelog

JetStream users

Please review release notes from v1.12.0 regarding important changes if upgrading from an earlier release.

Added

Fixed

  • JetStream:
    • Fetch() could return immediately with a timeout error. Thanks to @izarraga for the report (#813)
  • Inboxes suffix would contain many zeros (#808)

Complete Changes

v1.12.0...v1.12.1

Release v1.12.0

26 Aug 01:13
2ea8d39
Compare
Choose a tag to compare

Changelog

Breaking Changes

This release has some important and breaking changes for the JetStream module. Previously, it was possible to create multiple instances of non queue subscriptions to the same JetStream consumer, which was wrong since each instance would get a copy of the same message and one instance acknowledging a message would mean that the other instance's message acknowledgement (or lack thereof) would be ignored. It was also possible to create queue groups against a JetStream consumer that was used by a non queue subscription.

This update requires the upcoming server version v2.4.0 to behave correctly, that is, the library will reject a "plain" subscription on a JetStream consumer that is already bound (that is, there is already an instance actively consuming from it), or on a consumer that was created for a queue group. It will also reject a queue subscription on a JetStream consumer that was not created for a queue group, or to a consumer that has been created for a different queue group. But it means that this update will not be able to create a queue subscription on a server pre v2.4.0 because those server do not have the concept of DeliverGroup in the consumer configuration.

Look at the Changed section below for the list of those changes.

The repository master branch has been renamed main. If you have a fork or a clone of the repository, you should run those git commands:

git branch -m master main
git fetch origin
git branch -u origin/main main
git remote set-head origin -a

Added

  • JetStream:
    • Bind() and BindStream() options to the subscribe calls (#740)
    • ChanQueueSubscribe() (#744)
    • APIPrefix() and Domain() options to specify prefix or domain. Thanks to @Jarema for the contribution (#750, #753)
    • Two new sentinel errors: ErrStreamNotFound and ErrConsumerNotFound. Thanks to @actatum for the contribution (#760)
    • MaxMsgsPerSubject option in the StreamConfig (#768)
    • OrderedConsumer() subscription option to create a FIFO ephemeral consumer for in order delivery of messages. There are no redelivered and no ACKs, and flow control and heartbeats will be added but be taken care of without additional user code (#789, #793)
    • DeliverSubject() option to configure the deliver subject of a JetStream consumer created by the js.Subscribe() call (and variants) (#794)
    • Fields DeliverGroup in ConsumerConfig, PushBound in ConsumerInfo. They help making prevent incorrect subscriptions to JetStream consumers (#794)
    • Field Description in StreamConfig and ConsumerConfig (#795)
    • ExpectLastSequencePerSubject() publish option (#797)
    • DeliverLastPerSubject() subscribe option (#798)
  • CustomInboxPrefix connection option to set the custom prefix instead of _INBOX. (#767)

Changed

  • JetStream:
    • Conn.JetStream() no longer looks up account information (#739)
    • With a PullSubscription, calling NextMsg() or NextMsgWithContext() will now return ErrTypeSubscription. You must use the Fetch() API (#794)
    • If the library created internally a JetStream consumer, the consumer will be deleted on Unsubscribe() or when the Drain() completes (#794)
    • Fail multiple instances of a subscription on the same durable push consumer (only one active at a time). Also, consumers now have the concept of DeliverGroup, which is the queue group name they are created for. Only queue members from the same group can attach to this consumer, and a non queue subscription cannot attach to it. Note that this requires server v2.4.0 (#794)
    • Attempting to create a queue subscription with a consumer configuration that has idle heartbeats and/or flow control will now result in an error (#794)
    • ConsumerInfo's fields Delivered and AckFloor are now SequenceInfo objects that include the last activity (in UTC time) (#802)

Improved

  • Avoid unnecessary data copy in some situations. Thanks to @Endeavourken for the contribution (#788)
  • JetStream:
    • js.PullSubscribe() implementation that reduces the number of internal subscriptions being created/auto-unsubscribed (#791)
    • Subscribe calls will now return an error if the consumer configuration specified does not match the current consumer's configuration. Thanks to @kszafran for the suggestion (#803)

Fixed

  • JetStream:
    • Possible lock inversion (#794)
    • JetStream consumers could be incorrectly deleted on subscription's Unsubscribe() (#794)
  • Removed unused code. Thanks to @rutgerbrf for the contribution (#737)
  • Misspells in go doc. Thanks to @dtest11 for the contributions (#758, #759)
  • Websocket:
    • Decompression of continuation frames (#755)

Complete Changes

v1.11.0...v1.12.0

Release v1.11.0

04 May 01:52
3b1f6fc
Compare
Choose a tag to compare

Changelog

Added

  • Message Headers support
    • Conn.HeadersSupported() returns a boolean indicating if the server, the client is currently connected to, supports headers (#582)
  • JetStream support
  • Websocket support (#719)
  • LameDuckModeHandler to be notified when the server the application is connected to enters lame-duck mode (#572)
  • RequestMsg(), RequestMsgWithContext() and RespondMsg() APIs, which makes it possible to use message headers with requests and replies (#574)
  • RetryOnFailedConnect() option, which means that the Connect() calls will not fail right away if servers are not running at the first attempt to connect. Instead, the library will behave as if it was just disconnected. Thanks to @tomwilkie, @Zambiorix, @kekoav, @mnarrell, @serajam and @hbobenicio for their feedback (#581)
  • Support for "no responders" error on requests (#576)
  • Examples:
    • TLS options in nats-pub and mats-sub examples. Thanks @egodigitus for the contribution (#615)
    • --nkey flat to enable NKey authentication (#728)

Changed

  • ErrNoResponders is now returned for a request call for which there is no application servicing the request's subject (when connecting to a server that supports the feature). Applications checking for ErrTimeout only as a "normal" error would need to be updated (#576)

Updated

  • Dependencies (#573)
  • Added a go_test.mod file to limit tests dependencies versus library dependencies (#705)

Fixed

  • Comment for PublishRequest API. Thanks to @hasheddan for the contribution (#570)
  • Comment for encoded connection's Handler. Thanks to @aym-v for the contribution (#590)
  • Possible data race between an AutoUnsubscribe() and the routine delivering messages (#726)

Complete Changes

v1.10.0...v1.11.0

Release v1.10.0

14 May 01:30
120703c
Compare
Choose a tag to compare

Changelog

Added

  • Conn.GetClientIP() returns the client IP as known by the server. Works if connected to server 2.1.6+ (#559)
  • Conn.RTT() calculates the round trip time between this client and the server (#559)

Updated

  • Protobuf import for encoder (#557)
  • Change default of Conn.Flush() from 60 to 10 seconds (#561)
  • Bump default MAX_CONTROL_LINE to 4096 (#567)

Fixed

  • Possible panic on connect if discovered server list shrinks in that process. Thanks to @kirill256 for the contribution (#550)
  • Conn.Request() with UseOldRequest option was not returning on connection Conn.Close() (#558)
  • Added jitter to the reconnection logic (#564)
  • Randomize discovered server URLs (unless NoRandomize() option is set) (#566)

Complete Changes

v1.9.2...v1.10.0

Release v1.9.2

30 Mar 23:56
4d5d5d1
Compare
Choose a tag to compare

Changelog

Added

  • Option to set the reply subject in nats-pub example (#539)
  • The queue group name in nats-qsub example (#541)

Improved

  • Reduced lock contention for connections receiving their own messages (#529)

Updated

  • Dependencies, covering the golang crypto package CVE. The CVE mentions the ssh package, which this library does not use, so NATS Go client should not be affected. Thanks to @KauzClay for the contribution (#548)

Fixed

  • Do not use sync.Once.Do() in connection's first request. Thanks to @hubinix for the report (#538)

Complete Changes

v1.9.1...v1.9.2

Release v1.9.1

31 Oct 23:57
6063d67
Compare
Choose a tag to compare

Changelog

Fixed

  • In preparation for JetStream and support of subject rewriting, a bug was introduced that would cause multiple deliveries when before the delivery should have been only one per response. This affects only v1.9.0 (#528)

Complete Changes

v1.9.0...v1.9.1