Giter Site home page Giter Site logo

paambaati / node-liftbridge Goto Github PK

View Code? Open in Web Editor NEW
13.0 5.0 4.0 1.22 MB

๐ŸŒ‰ Node.js client for Liftbridge

Home Page: https://paambaati.github.io/node-liftbridge/globals.html

License: MIT License

JavaScript 54.80% Shell 1.22% TypeScript 43.99%
nodejs grpc grpc-node liftbridge nats messaging stream

node-liftbridge's Introduction

node-liftbridge

Node.js client for Liftbridge.

Liftbridge provides lightweight, fault-tolerant message streams by implementing a durable stream augmentation for the NATS messaging system. It extends NATS with a Kafka-like publish-subscribe log API that is highly available and horizontally scalable. Use Liftbridge as a simpler and lighter alternative to systems like Kafka and Pulsar or use it to add streaming semantics to an existing NATS deployment.

๐Ÿšง This module is still under active development! Would you like to contribute? ๐Ÿšง

Installation

yarn add liftbridge
# or
npm install liftbridge

Usage

import LiftbridgeClient from 'liftbridge';

const client = new LiftbridgeClient('localhost:9292');
await client.connect();

await client.createStream(new LiftbridgeStream({
     subject: 'my-subject',
     name: 'stream-name',
     partitions: 5,
     maxReplication: true
});

๐Ÿ“š See Documentation for more detailed examples.

Developer Notes

  1. To regenerate the gRPC bindings, update the path to the latest proto file and then run ./scripts/generate_grpc_code.sh

Roadmap

  • Tests & coverage
  • CI
  • Contribution guide
  • gRPC Connection pool
  • Logging

node-liftbridge's People

Contributors

paambaati avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

node-liftbridge's Issues

Failed to parse server response

Thanks for compiling this library ๐Ÿ‘‹ ๐Ÿ‘ I just tried to build a little prototype in order to get a feeling of how everything is like in Node.js land.

Started liftbridge as described in the quick start:

docker run -d --name=liftbridge-main -p 4222:4222 -p 9292:9292 -p 8222:8222 -p 6222:6222 liftbridge/liftbridge-docker

Created a stream, published a message and read via a subscription:

import LiftbridgeClient, { Message } from "liftbridge";
import LiftbridgeMessage from "liftbridge/lib/message";
import LiftbridgeStream from "liftbridge/lib/stream";

const app = async () => {
  const client = new LiftbridgeClient("localhost:9292");

  await client.connect();

  const name = `my-stream-v${Date.now()}`;
  const subject = `my-subject-v${Date.now()}`;

  const streamDef = new LiftbridgeStream({
    name,
    subject,
    partitions: 1,
    maxReplication: true
  });

  await client.createStream(streamDef);

  await client.publish(
    new LiftbridgeMessage({
      subject,
      key: Date.now().toString(),
      value: JSON.stringify({
        foo: "bar"
      })
    })
  );

  const subscription = client.subscribe(
    new LiftbridgeStream({
      subject,
      name
    })
  );

  subscription.on("data", (data: Message) => {
    console.log("message");
    console.log(data);
  });
};

app().catch(err => {
  process.exitCode = 1;

  console.error(err);
});

Creating the stream and publishing the message seems to work. Consuming the stream fails with a:

Error: 13 INTERNAL: Failed to parse server response

I also tried to generate a new gRPC binding, but this leads to the same result above ๐Ÿ™

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.