Releases: nats-io/nats.go
Release v1.21.0
Changelog
Added
ConnectHandler
connect option to detect that initial connection was established. This is especially useful when combined withRetryOnFailedConnect
(#1133 )IgnoreAuthErrorAbort
connect option to prevent aborting reconnect attempts after receiving the same authentication error twice (#1141)SkipTLSHandshake
option toCustomDialer
.SkipTLSHandshake
method can be implemented on a custom dialer to prevent TLS handshake if not needed (#1147)- KV:
- JetStream:
- Add
ErrLeadershipChanged
error, returned when consumer leadership has changed during a pull request on a consumer. Thanks to @sata-form3 for the contribution (#1151)
- Add
Improved
- Remove deprecated usages of
io/ioutil
. Thanks to @cesarvspr for the contribution (#1150) - Remove experimental notice from KV implementation (#1154)
Complete Changes
Release v1.20.0
Changelog
Changed
- JetStream:
- [BREAKING CHANGE] Extract
nats: Consumer Deleted
server error toErrConsumerDeleted
variable. This error is returned when consumer is deleted while waiting on pull request and was introduced in nats-server v2.9.6 (#1125)
- [BREAKING CHANGE] Extract
Improved
- JetStream:
- Fix broken comments on
ErrConsumerNameAlreadyInUse
andStreamNameBySubject()
. Thanks to @subtle-byte for the contribution (#1128)
- Fix broken comments on
- Core NATS:
- Improve comment on
RetryOnFailedConnect
connect option (#1127)
- Improve comment on
Complete Changes
Release v1.19.1
Release v1.19.0
Changelog
Added
- KV:
- Support for KV mirrors and sources (#1112)
Improved
- JetStream:
- Comment on
InactiveThreshold
to align with server version 2.9.0. Thanks to @neilalexander for the contribution (#1106)
- Comment on
Experimental
- Added Service framework for microservice communication using core NATS. This is an experimental preview and may be changed in future releases (#1111)
Complete Changes
Release v1.18.0
Changelog
Added
- JetStream:
- Support for
DiscardNewPerSubject
on stream configuration (#1102)
- Support for
- KV:
Improved
- JetStream:
Changed
- JetStream:
- ObjectStore:
- [BREAKING]
ObjectStores()
now returns channel ofObjectStoreStatus
instead ofObjectStore
interface (#1099) - [BREAKING] Options on various
ObjectStore
methods now have individual types (GetObjectOpt
,GetObjectInfoOpt
andListObjectsOpt
). Only options applicable for a particular method can be used (#1091) - [BREAKING] When listing/fetching object info, deleted objects are now hidden by default. New options are added to enable fetching deleted objects (
GetObjectInfoShowDeleted()
,GetObjectShowDeleted()
andListObjectsShowDeleted()
(#1091)
- [BREAKING]
Fixed
- JetStream:
- Invalid JSON tag on
Tiers
field onAccountInfo
struct (#1095)
- Invalid JSON tag on
Complete Changes
Release v1.17.0
Changelog
IMPORTANT
This release uses a new consumer create API when interacting with nats-server version 2.9.0 or higher. This changes the subjects used by the client to create consumers, which might in some cases require changes in access and import/export configuration. To opt out of this feature, use UseLegacyDurableConsumers()
option when creating JetStreamContext
.
Added
-
JetStream:
- Support for enhanced stream purge.
PurgeStream()
now acceptsStreamPurgeRequest
as an option, allowing partial purge by subject sequence number or keeping selected number of messages (#988) - Option to fetch
DeletedDetails
when fetchingStreamInfo
.StreamInfo()
now acceptsStreamInfoRequest
allowing to passDeletedDetails
flag (#990) - Option to report subjects on
StreamInfo()
request.StreamInfo()
now acceptsStreamInfoRequest
allowing to passSubjectsFilter
value (#1010) - Support
AllowDirect
in stream configuration, enabling faster access to individual messages on a stream (#991) - Support for
DirectGet
API inGetMsg()
throughDirectGet()
andDirectGetNext()
options (#1020, #1030) HeadersOnly
option toRePublish
field on stream configuration and change struct name toRePublish
(#991)SecureDeleteMsg()
method to securely delete and overwrite a message on a stream (#1025)MaxRequestMaxBytes()
PullConsumer()
option allowing setting the maximum number of bytes a singleFetch()
can receive (#1043)- Filter streams and stream names by subject in
StreamsInfo()
andStreamNames()
usingStreamListFilter()
option (#1062) - Accept
AckAll
for pull consumers. Thanks to @neilalexander for the contribution (#1063) - Support for setting consumer replicas through
Subscribe()
options. Thanks to @goku321 for the contribution (#1019) - Support for setting memory storage on consumer with
ConsumerMemoryStorage()
option inSubscribe()
. Thanks to @goku321 for the contribution (#1078)
- Support for enhanced stream purge.
-
KV:
RePublish
option on key value configuration (#1031)
-
ObjectStore:
ObjectStores()
andObjectStoreNames()
methods for listing object store buckets (#1074)
-
TLSConnectionState()
to expose TLS connection state (#996) -
UserJWTAndSeed
helper function accepting JWT and seed as parameters (#1046) -
natsProtoErr
type for proto error normalization and comparison usingerrors.Is()
(#1082)
Improved
-
JetStream
- Add
JetStreamError
type for all JetStream related errors, containing error codes (for API errors).JetStreamError
supports comparing and unwrapping errors using nativeerrors
package (#1044, #1047) - Force
Subscribe()
to use memory storage and no replicas when usingOrderedConsumer()
(#989) - Consistent error value of context timeout when using
Fetch()
on pull subscription. Thanks to @wdhongtw for the contribution (#1011) - Add additional note to
PullSubscribe()
on durable semantics (#994)
- Add
-
KV:
- Utilize
DirectGet()
in KV for improved performence (#1020)
- Utilize
-
Add support for reporting flusher errors. THanks to @GeorgeEngland for the contribution (#1015)
-
Mention field defaults in
Options
struct documentation. Thanks to @costela for the contribution (#1013)
Changed
- JetStream:
Updated
-
JetStream:
- [BREAKING] Use new consumer create API when interacting with nats-server version 2.9.0 or higher. This changes the subjects used by the client to create consumers, which might in some cases require changes in access and import/export configuration. To opt out of this feature, use
UseLegacyDurableConsumers()
option when creatingJetStreamContext
(#1080) - Add missing fields to
AccountInfo
schema (#1026) - Align
StreamSourceInfo
schema with server (#1039)
- [BREAKING] Use new consumer create API when interacting with nats-server version 2.9.0 or higher. This changes the subjects used by the client to create consumers, which might in some cases require changes in access and import/export configuration. To opt out of this feature, use
-
Use nats-server 2.9.0 in tests (#1073)
-
Add new test TLS certs and run tests for go 1.18 in CI (#1023, #1055)
Fixed
-
JetStream
Subscribe()
automatically sending ACK whenAckPolicyNone
is set (#987)- Return error when attempting to ACK a message on a
AckNone
consumer (#1032) - Use native time.Time.Equal method for equality check when comparing consumer configs (#993)
- Ephemeral PullConsumer's Fetch() failing with "no responders" (#1022)
ConsumerInfo
nil pointer dereference whenjsi
is not initialized. Thanks to @Sergey-Belyakov for the contribution (#1024)- Paging in stream and consumer name listing (#1060)
-
ObjectStore
- Update object
Put()
to avoid loosing last chunk whenReader
returns both value andEOF
. Thanks to @tinou98 for the contribution (#995) - Invalid digest decoding on object
Get()
, not propagating errors fromGet()
to the user (#1052) - Allow updating meta if new name exists but is deleted (#1053)
- Disallow adding links in
Put()
object meta (#1057)
- Update object
-
Typo in
CustomInboxPrefix()
error message. Thanks to @subtle-byte for the contribution (#1028) -
Ignore trailing comma at the end of URL lists (#1058)
Complete Changes
Release v1.16.0
Changelog
Added
- JetStream:
- Experimental:
StreamConfig.RePublish
configuration, which is aSubjectMapping
(source/destination) which allows the republish of a message after being sequenced and stored (#980) - Experimental: Two new
ConsumerConfig
fields:Replicas
andMemoryStorage
which are generally inherited by parent stream, but can be configured directly (#980)
- Experimental:
- Websocket:
ProxyPath()
option to add a path to websocket connection URLs. Thanks to @ido-gold-apolicy for the contribution (#974)
Complete Changes
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)