Release Notes

EventStoreDB NodeJS gRPC client V3.0.0

George Payne  |  03 February 2022

The EventStoreDB NodeJS gRPC client V3.0.0 has been released, bringing support for Persistent Subscriptions to the $all Stream, along with faster appending of events, and more. There are several breaking changes between this and the current v2 release, so be sure to check those below.

For full details of how to use these new features (as well as all the existing ones) visit our documentation site. If you have any questions about the NodeJS client, feel free to contact us or ask a question on Discuss.

Features

Persistent Subscriptions to $all

The client now supports persistent subscriptions to the $all stream, for server version 21.10 and greater. Visit the documentation for up-to-date details on how to use this feature.

const groupName = "my_persistent_subscription";
const settings = persistentSubscriptionToAllSettingsFromDefaults({
    // start from the beginning of the all stream
    startFrom: START,
});
// Filter only events with type matching regex
const filter = eventTypeFilter({
    regex: "^[0-9]*_regex_filter_eventType_[A-z]*$",
});

// Create a persistent subscrition to the all stream
await client.createPersistentSubscriptionToAll(groupName, settings, { filter });
  • Added subscribeToPersistentSubscriptionToAll method. View it here.
// Connect to the created persistent subscription to all stream
const psToAll = client.subscribeToPersistentSubscriptionToAll(groupName);

for await (const event of psToAll) {
    doSomethingWithEvent(event);
    // Acknowledge that the event has been handled
    await psToAll.ack(event);
}
const updatedSettings =  persistentSubscriptionToAllSettingsFromDefaults({
  // Ensure that our previous settings are persisted
  ...settings,
  // Enable extra statistics
  extraStatistics: true,
});
  
// Update the persistent subscription to use new settings.
await client.updatePersistentSubscriptionToAll(groupName, updatedSettings);
// delete the unwanted persistent subscription to all
await client.deletePersistentSubscriptionToAll(groupName);

Other features

  • When connected to server version 21.10 and greater, the client will now send appended events over a single duplex stream, resulting in much faster append times. View it here.
  • The client now internally checks if the server supports an API before sending a request. View it here.
  • fromPartition option added to getProjectionState View it here.
  • Improved tlsVerifyCert not supported message View it here.

Breaking changes

EventStoreDBClient

  • The default node preference is now LEADER. This applies when connecting with a connection string, and via the client constructor. View it here.

Persistent Subscriptions

The persistent subscriptions API has been updated to align with other Event Store clients, and the new persistent subscriptions to all APIs.

  • connectToPersistentSubscription has been renamed to subscribeToPersistentSubscription View it here.
  • persistentSubscriptionSettings keys and default values have been changed. View it here.
Key Default Description
- fromRevision
+ startFrom
- START
+ END
The exclusive position in the stream or transaction file the subscription should start from.
- extraStats
+ extraStatistics
false Enables if depth latency statistics should be tracked on subscription.
- checkpointAfter
+ checkPointAfter
2_000 The amount of time to try checkpoint after in milliseconds.
- minCheckpointCount
+ checkPointLowerBound
10 The minimum number of messages to process before a checkpoint may be written.
- maxCheckpointCount
+ checkPointUpperBound
1_000 The maximum number of messages to process before a checkpoint may be written.
maxSubscriberCount
- UNLIMITED
+ UNBOUNDED
The maximum number of subscribers allowed..
- strategy
+ consumerStrategyName
ROUND_ROBIN The strategy to use for distributing events to client consumers.
-- The following options remain unchanged. --
resolveLinkTos false Also return events targeted by the links.
messageTimeout 30_000 The amount of time in milliseconds after which a message should be considered to be timeout and retried.
maxRetryCount 10 The maximum number of retries (due to timeout) before a message is considered to be parked.
liveBufferSize 500 The size of the buffer listening to live messages as they happen.
readBatchSize 20 The number of events read at a time when paging in history.
historyBufferSize 500 The number of events to cache when paging through history.
  • Constant UNLIMITED has been renamed to UNBOUNDED. View it here.

Projections

The projections API has been completely overhauled, removing one-time and transient projections. View it here.

  • createProjection:
    • createContinuousProjection has been renamed to createProjection.
    • createOneTimeProjection has been removed.
    • createTransientProjection has been removed.
  • listProjections:
    • listContinuousProjections has been renamed to listProjections.
    • listOneTimeProjections has been removed.
    • listTransientProjections has been removed.
    • mode has been removed from ProjectionDetails, only CONTINUOUS projections are returned.
    • CONTINUOUS ONE_TIME & TRANSIENT constants have been removed.
  • resetProjection:
    • writeCheckpoint option has been removed (it previously had no effect).
  • disableProjection:
    • writeCheckpoint option has been removed. Use abortProjection if wishing to set this to false.
  • abortProjection:
    • abortProjection method has been added.
  • deleteProjection:
    • deleteEmittedStreams option now defaults to false.
    • deleteStateStream option now defaults to false.
    • deleteCheckpointStream option now defaults to false.
  • getProjectionState & getProjectionResult:
    • fromPartition option has been renamed to partition View it here.

Client deadlines

The client now supports setting deadlines for non-streaming gRPC requests, with a default deadline of 10 seconds (formerly Infinity). View it here.

  • defaultDeadline global setting has been added to the constructor options and connection string.
  • deadline option has been added to all methods, to allow setting the deadline per request.
  • DeadlineExceeded error will now be thrown if a deadline has been exceeded.

Bug fixes

  • Fixed incorrect log message where HTTP was logged as HTTPS and vice versa. View it here.
  • updateProjection option trackEmittedStreams name has been corrected as emitEnabled. View it here.
  • Prevent WRITE_AFTER_END from still being uncaught in rare cases. View it here.

Removal of deprecated APIs


Photo of George Payne

George Payne George Payne is a Developer for Event Store residing in The Netherlands.