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)