Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrate Rust Client Bridge #400

Open
wants to merge 12 commits into
base: w1am/DEVEX-189-rebrand-node-client
Choose a base branch
from

Conversation

w1am
Copy link
Collaborator

@w1am w1am commented Feb 17, 2025

Highlights

  1. Use Rust client for read operations
  2. Added a benchmark workflow in GitHub Actions. You can run the benchmark on GitHub by dispatching it manually
xychart-beta
    title "KurrentDB NodeJS Client Performance Comparison"
    x-axis ["EventStoreDB Client v6.2.1", "KurrentDB Client v1.0.0-alpha.0", "KurrentDB bridge"]
    y-axis "Events per millisecond" 0 --> 70
    bar [31.33, 60.66, 65.58]
Loading

Breaking Changes

This document outlines the breaking changes introduced in the upcoming release of the KurrentDB client, which includes a performance boost for read operations as it now uses the Rust client for these operations. Upgrading users must address these changes to ensure compatibility.


1. Client Initialization via Connection String

What Changed

We've removed the class constructor method for initializing KurrentDBClient. Clients must now be created using a connection string, aligning with patterns used in other clients in our ecosystem.

Migration Guide

Old Approach

// Legacy constructor-based initialization
const client = new KurrentDBClient({
      { endpoint: "localhost:2113" },
      { rootCertificate: node.certs.root },
      { username: "admin", password: "changeit" }
});

Change to

const client = KurrentDBClient.connectionString`kdb://localhost:2113?tls=false`;

NOTE: If you were using connection string, the code will remain unchanged.


2. Node.js 14 Deprecation

What Changed

We've officially dropped support for Node.js 14 following the Node.js Release Schedule.

Action Required

  • Upgrade to Node.js v20 or higher (LTS)
  • If maintaining multiple Node versions, use a version manager like nvm:
    nvm install --lts
    nvm use --lts

Impact

  • CI/CD pipelines using Node 14 will fail
  • TypeScript definitions now use features from ES2021+

3. Stream Handling Migration to Async Iterables

What Changed

Previously, we supported both event emitter pattern and async iteration. In this release, we've removed event emitter pattern and now support only async iteration.

Migration Guide

Previously Supported Approaches

// Event Emitter Pattern
client
  .readAll()
  .on("data", (event) => handleEvent(event))
  .on("error", (err) => handleError(err));

// Async Iteration Pattern
try {
  const stream = client.readAll();
  for await (const event of stream) {
    handleEvent(event);
  }
} catch (err) {
  handleError(err);
}

Now Required

try {
  const stream = client.readAll();
  for await (const event of stream) {
    handleEvent(event);
  }
} catch (err) {
  handleError(err);
}

@EventStore EventStore deleted a comment from github-actions bot Feb 17, 2025
@w1am w1am force-pushed the kurrent-rust-client-bridge branch 7 times, most recently from ea530fa to 12f46b3 Compare February 17, 2025 07:50
@w1am w1am force-pushed the kurrent-rust-client-bridge branch from 12f46b3 to 9889e6a Compare February 17, 2025 08:01
@w1am w1am force-pushed the kurrent-rust-client-bridge branch from 4d3bad4 to b0362e3 Compare February 17, 2025 08:33
@EventStore EventStore deleted a comment from github-actions bot Feb 17, 2025
@w1am w1am force-pushed the kurrent-rust-client-bridge branch from 2a73d86 to 7298242 Compare February 17, 2025 19:02
* Remove readStream from channel test because it's not handled by node
  client anymore
@w1am w1am force-pushed the kurrent-rust-client-bridge branch from 7298242 to 52227fd Compare February 17, 2025 19:27
@w1am w1am force-pushed the kurrent-rust-client-bridge branch 3 times, most recently from a14f17e to c40d73a Compare February 18, 2025 11:09
@w1am w1am force-pushed the kurrent-rust-client-bridge branch from c40d73a to b1a139a Compare February 18, 2025 11:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants