github nats-io/nats.go v1.12.0
Release v1.12.0

latest releases: v1.37.0, v1.36.0, v1.35.0...
3 years ago

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

Don't miss a new nats.go release

NewReleases is sending notifications on new releases.