Skip to content

rkrishn7/ksqldb-client-node

Repository files navigation

ksqldb-client-node

CI Coverage Status npm version install size semantic-release: angular

A ksqlDB client for NodeJS

Table of Contents

Installation

$ yarn add ksqldb-client-node

Usage

import { KsqlDbClient } from 'ksqldb-client-node';

// Create the client
const client = new KsqlDbClient({
  url: 'http://localhost:8088',
});

// Create a new session to enable communication with the server's HTTP/2 endpoints
const session = client.session();

// Create a new query stream and subscribe to the updates
const queryStream = session.queryStream<QueryResult>({
  sql: 'SELECT * FROM STREAM EMIT CHANGES;',
});

for (await resultSet of queryStream) {
  // do work...
}

// Destroy the session handle
session.close();