A ksqlDB client for NodeJS
$ yarn add ksqldb-client-node
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();