v1.1.0
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 forSubscription
objects. The property is a promise that when resolved notifies that the subscription has stopped processing messages.
JetStream
-
[FIX] exposed
erase
argument forjsm.stream.deleteMessage()
-
[FIX] marked
StreamConfig
duplicate_window
to be Nanos -
[FEAT] added
max_msgs_per_subject
toStreamConfig
-
[FEAT] added
idle_heartbeat
andflow_control
toConsumerConfig
-
[FEAT] added util
isHeartbeatMsg()
and exposedisFlowControlMsg()
as these may be useful for direct NATS subscribers processing JetStream messages -
[FEAT] added support for JetStream
domain
inJetStreamOptions
. 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
reportsdomain
when set on the server (returned when callingjsm.getAccountInfo()
). -
[FEAT] [BREAKING] Slight change to JSM streams
getMessage()
the API the second argument changed from a sequence number to be either{seq: #}
orlast_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
toexpect
inJetStreamPublishOptions
, 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 addedStreamSourceHdr
, 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.