Skip to content

Releases: nats-io/nats.deno

v1.2.0

25 Aug 21:43
dc0322e
Compare
Choose a tag to compare

BREAKING CHANGES

This release contains a set of changes that are API-breaking for JetStream. Since the JetStream APIs on the JavaScript clients are Preview, only the minor version of the client has been bumped. Because of these changes, you should carefully read the Breaking Changes section to ensure you are not affected.

JetStream Push Consumers In Queue Groups

The Push Consumer Queue feature has changed. A new nats-server (2.4.0) is in the works that modifies how this feature works.
The new JavaScript clients have been modified to work with the new server and will fail to work with an existing server using push consumers with queue groups.

Previously it was possible to create a push consumer and properly get it working in a queue group with a regular NatsConnection#subscribe or NatsConnection#jetstream()#subscribe() if all queue subscriptions used the same queue name and no plain (non-queue) subscriptions were used.

If the mix of subscriptions and queues referenced the same consumer but provided different queue names or no queue names, the delivery of messages was incorrect and could create conditions where some messages were seen in duplicate or have unexpected side effects.

The new nats-server changes will make an old consumer configuration with a queue group a noop - the server will not send messages to the client. To enable a queue group to work on a consumer:

  • The consumer configuration must specify a deliver_group matching the queue group name.
  • Configurations that use the consumer with a non-matching queue group will be invalid.
  • Configurations that use a queue group consumer without a queue group will be invalid.

The nats client for JavaScript on 1.2.0 and beyond, enforces the above rules, so an Error is thrown from NatsConnection#jetstream().subscribe() for configurations that try to use the queue group incorrectly.

Because an old server will not report deliver_group for the consumer, any jetstream#subscribe() that attempts to specify a queue group will fail the validation.

If you are creating nats your own nats subscription to handle the consumer, and have an old server, you may continue to do that until you upgrade the server, at which point the nets-server will stop delivering messages to your client. Please do ensure that you don't use the consumer from different queue groups in the meanwhile.

JetStreamManager#streams#getMessage(number)

This API has been removed (it was deprecated and printing console messages). To retrieve a message by its sequence,
replace with JetStreamManager#streams#getMessage({seq: number}).

Other Changes

  • [FIX] JetStream ConsumerInfo type was not exported. Also changes SequencePair to be named SequenceInfo to match changes in the server. These types were only referenced from ConsumerInfo which was not exported.

  • [FEAT] Added DeliveryPolicy#LastPerSubject which allows a consumer to get the last message for each subject in a stream.

  • [FIX] Exported functions millis(ns: number):number and nanos(millis: number):number to allow conversion between these number types. millis() converts nanoseconds to millis, and nanos() millis to nanoseconds) - some of the JetStream APIs expose these values and the client may want to translate to something more meaningful. Note future versions may change the return values of these functions to bigint`.

  • [FIX] Stats (NatsConnection#stats(): Stats) and ServerInfo (NatsConnection#info), PubAck (return type for JetStream#publish(), are now exported types.

  • [FEAT] Exported isNatsError(), checkJsError(), isFlowControlMsg(), isHeartbeatMsg as these are sometimes useful for lower level subscriptions handling JetStream messages.

  • [FEAT] PubAck now reports a domain field representing the JetStream domain if set or returning an empty string. This feature requires a newer server.

  • [FIX] ConsumerConfig now have fields deliver_group, description.

v1.1.0

01 Jul 20:55
c45adca
Compare
Choose a tag to compare

This release addresses compatibility with JetStream features introduced in recent nats-server releases, as well as addresses some minor issues. These fixes/enhancements are all part of the NBC (nats-base-client) library on which all JavaScript clients are based.

NATS

  • [FIX] Fixed a bug when parsing headers that stopped if the header contained a non-default status, non-OK messages may contain additional header entries

  • [FEAT] exposed closed property for Subscription objects. The property is a promise that when resolved notifies that the subscription has stopped processing messages.

JetStream

  • [FIX] exposed erase argument for jsm.stream.deleteMessage()

  • [FIX] marked StreamConfig duplicate_window to be Nanos

  • [FEAT] added max_msgs_per_subject to StreamConfig

  • [FEAT] added idle_heartbeat and flow_control to ConsumerConfig

  • [FEAT] added util isHeartbeatMsg() and exposed isFlowControlMsg() as these may be useful for direct NATS subscribers processing JetStream messages

  • [FEAT] added support for JetStream domain in JetStreamOptions. When a JetStream client is created with this option, the string value in the option is used to auto-generate the prefix used to access JetStream apis ($JS.<domain>.API). This option must be set matching a similar option set on the NATS server.

  • [FEAT] JetStreamAccountStats reports domain when set on the server (returned when calling jsm.getAccountInfo()).

  • [FEAT] [BREAKING] Slight change to JSM streams getMessage() the API the second argument changed from a sequence number to be either {seq: #} or last_by_subject: "my.subject", this enables the feature for retrieving the last message in a stream with the specified subject. For the next couple releases the number argument will be shimmed to {seq: number} but the shim will be removed before release. If you are using the deprecated API the client will print a message. The JetStream features in the JavaScript clients are pre-release and subject to changes.

  • [FEAT] added lastSubjectSequence to expect in JetStreamPublishOptions, this enables clients to assert that the last sequence on a subject is as expected (no new messages have been received on that subject).

  • [FEAT] added the ability to purge streams by subject, sequence, or trimming to a specific number of messages.

  • [FEAT] exposed JsHeaders enum with possible headers from JetStream (LastStreamSeqHdr/LastConsumerSeqHdr) which are sent on heartbeats. Also added StreamSourceHdr, which is possible when a message is coming from a source.

  • [FIX] corrected optional fields from StreamSource

  • [FIX] exported isFlowControlMsg/isHeartbeatMsg, LastForMsgRequest, SeqMsgRequest

  • [FIX] added documentation on these features along with samples.

v1.0.8

24 Jun 12:38
46c7f7b
Compare
Choose a tag to compare

[FIX] ConsumerOpts now provides the queue() option enabling Jetstream push subscribers on a durable to form a queue group. #162

v1.0.7

14 Jun 15:16
340f418
Compare
Choose a tag to compare

[FIX] Match was not exported in the mod.ts nor on internal_mod.ts (other derivatives exported it via their typescript bindings).

v1.0.6

02 Jun 15:59
24498cf
Compare
Choose a tag to compare
  • [FIX] Consumer options consumerOpts() don't provide access to all the options possible - provided a path for specifying a new consumer configuration to the builder, unblocking the requirement to pre-create those types of consumers #153
  • [FIX] Fixed an issue where preventing double-acks prevented repeat invocations of +WPI, which should be allowed an unbounded number of times #154
  • [FIX] Relaxed header parsing to allow plain : (without a following whitespace). Values are also trimmed. Malformed headers (for example a key with no following colon) are ignored nats-io/nats.js#430
  • [FIX] Removed rogue reference to window nats-io/nats.js#428

v1.0.4

10 May 20:47
7a7a9e6
Compare
Choose a tag to compare

Important Changes

This release modifies the way that headers are implemented. Previously all lookups were case insensitive as the library stored and expected all keys to be in canonical form. This release changes functionality to be case-sensitive by default. An additional optional argument Match (an enum) changes the behavior between case-sensitive (exact), canonical (compatible with previous releases), and ignore-case.

Complete Notes

  • [update] Updated Deno std to 0.95.0 #151
  • [change] breaking - Headers are now case sensitive #145
  • [feat] JetStream added support for stream info deleted sequences #143
  • [fix] Subscriptions with callbacks now have timeouts honored #148
  • [fix] Added a workaround to enable source compatibility in both Deno 1.8.3 and 1.9.x #146
  • [fix] Removed use of nullish operator as downstream uses with react-create-app will fail to build otherwise #141

v1.0.2

05 Apr 22:35
6b25e37
Compare
Choose a tag to compare
  • [fix] added cluster to possible properties in ServerInfo
  • [change] jetstream max_age - in StreamConfig marked as Nanos
  • [fix] omission of headers in JetStreamPublishOptions

v1.0.1

27 Mar 00:23
34bde46
Compare
Choose a tag to compare
  • [fix] the reply subject was sometimes copied incorrectly when message payloads are large and not received within the same write #134
  • [fix] mux subscriptions had their base inbox subject doubly initialized #135
  • [feat] DebugEvents has been made accessible to downstream. #131
  • [feat] JetStream Listers are now async iterables as well #129

v1.0.0

15 Mar 16:41
90ad783
Compare
Choose a tag to compare

Changes since RC4

  • [breaking] Events/DebugEvent/ErrorCode constants have been changed to follow ES5 naming conventions
  • [feat] added internal functionality to support JetStream
  • [feat] MsgHdrs always have a code
  • [feat] added support for JetStream (on preview). JetStream functionality is described here. Some basic examples can be found here.
  • [upgrade] deno std from 0.83.0 to 0.90.0

v1.0.0-rc4

25 Feb 18:22
Compare
Choose a tag to compare
  • [feat] added the inboxPrefix connection option to modify the names of subjects generated by createInbox() or when making requests.
  • [feat] the JSONCodec is now a generic helping the typing of the parameter or return value.