Skip to content

v1.1.0

Compare
Choose a tag to compare
@aricart aricart released this 01 Jul 20:55
· 682 commits to main since this release
c45adca

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.