Releases: nats-io/nats.go
Release v1.15.0
Changelog
Experimental
The ObjectStore
is still experimental and subject to change.
Added
- ObjectStore:
MaxBytes
in theObjectStoreConfig
structure (#955)
Improved
- JetStream:
- Ability pass
0
tonats.ExpectLastSequence(0)
andnats.ExpectLastSequencePerSubject(0)
to thejs.Publish()
call. Previously, the value0
would be ignored and the header would not be set. Note that currently, the server only accepts0
as a valid value fornats.ExpectLastSequencePerSubject()
. Thanks to @bruth for the contribution (#958)
- Ability pass
Fixed
- JetStream:
- A PullConsumer's Fetch() method with a batch greater than 1 and with other pull consumers running, may timeout although messages would have been available (#967)
Complete Changes
Release v1.14.0
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
andInactiveThreshold
(#893)NakWithDelay()
new acknowledgment call, andBackOff
list of duration in theConsumerConfig
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, orErrKeyNotFound
if the key does not exist or not at the expected revision. Thanks to @boxboatmatt for the contribution (#903)Placement
in theKeyValueConfig
structure (#929)- Expose
nats.Context()
option for thenats.KeyWatcher
interface. Thanks to @boxboatmatt for the contribution (#904)
- ObjectStore:
ConnectedUrlRedacted()
a redacted version ofConnectedUrl()
(#923)
Changed
- JetStream:
- The library no longer sets a default
MaxAckPending
when creating a JetStream consumer onSubscribe()
. 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 aPublish()
orStreamInfo()
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 optionsRetryWait()
andRetryAttempts()
(#930) PublishMsgAsync()
will now be limited to4,000
maximum asynchronous publish calls inflight, if no maximum has been specified withPublishAsyncMaxPending()
option.
- The library no longer sets a default
- KeyValue:
Delete()
andPurge()
now accept optionalDeleteOpt
options. The option available isLastRevision()
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 optionalPurgeOpt
values, notWatchOpt
. The newDeleteMarkersOlderThan()
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 withDiscardNew
instead ofDiscardOld
. The library will now automatically update an existing stream for a KeyValue fromDiscardOld
toDiscardNew
(#917)
Improved
- Websocket:
- 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:
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)
- Typo in
- 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 callingAddConsumer
against a missing stream (#881) - Prefix the error returned by
StreamInfo()
withnats:
to matchConsumerInfo()
(#928)
- KeyValue:
- 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 withwebsocket invalid connection
(#915) - Deadlock on authentication failure that manifested by a
Connect()
hanging forever. Thanks to @wenerme for the report (#926)
- When using secure connection
Complete Changes
Release v1.13.0
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:
- 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()
andAck()
. 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
Release v1.12.3
Release v1.12.2
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
Fixed
- JetStream:
- Unblock Pull Subscribe requests on a 408 with at least a message already fetched (#823)
- Websocket:
Complete Changes
Release v1.12.1
Changelog
JetStream users
Please review release notes from v1.12.0 regarding important changes if upgrading from an earlier release.
Added
- Stringer for connection's
Status()
. Thanks to @josephwoodward for the contribution (#812)
Fixed
- JetStream:
- Inboxes suffix would contain many zeros (#808)
Complete Changes
Release v1.12.0
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()
andBindStream()
options to the subscribe calls (#740)ChanQueueSubscribe()
(#744)APIPrefix()
andDomain()
options to specify prefix or domain. Thanks to @Jarema for the contribution (#750, #753)- Two new sentinel errors:
ErrStreamNotFound
andErrConsumerNotFound
. Thanks to @actatum for the contribution (#760) MaxMsgsPerSubject
option in theStreamConfig
(#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 thejs.Subscribe()
call (and variants) (#794)- Fields
DeliverGroup
inConsumerConfig
,PushBound
inConsumerInfo
. They help making prevent incorrect subscriptions to JetStream consumers (#794) - Field
Description
inStreamConfig
andConsumerConfig
(#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
, callingNextMsg()
orNextMsgWithContext()
will now returnErrTypeSubscription
. You must use theFetch()
API (#794) - If the library created internally a JetStream consumer, the consumer will be deleted on
Unsubscribe()
or when theDrain()
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 fieldsDelivered
andAckFloor
are nowSequenceInfo
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:
- 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
Release v1.11.0
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()
andRespondMsg()
APIs, which makes it possible to use message headers with requests and replies (#574)RetryOnFailedConnect()
option, which means that theConnect()
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
andmats-sub
examples. Thanks @egodigitus for the contribution (#615) --nkey
flat to enable NKey authentication (#728)
- TLS options in
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 forErrTimeout
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
Release v1.10.0
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()
withUseOldRequest
option was not returning on connectionConn.Close()
(#558)- Added jitter to the reconnection logic (#564)
- Randomize discovered server URLs (unless
NoRandomize()
option is set) (#566)
Complete Changes
Release v1.9.2
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)