Options
All
  • Public
  • Public/Protected
  • All
Menu

Fluvio Client for Node.js

Node.js binding for Fluvio streaming platform.

Build Status Github All Releases License

Installation on NPM

npm install @fluvio/client

Fluvio client is native module. It is written using Rust. The client will install the platform specific native .node module.

The Fluvio client uses TypeScript for typed definitions.

Documentation

Fluvio client uses Typedoc to generate the client API documentation.

Pre-Requisites

Fluvio should be up and running to use the Node fluvio client.

Click the link for installation instructions on the Fluvio GitHub repository.

Example usage

import Fluvio, { RecordSet } from '@fluvio/client';

// define the name of the topic to use
const TOPIC_NAME = "my-topic"

// define the partition where the topic
// records will be stored;
const PARTITION = 0

// Instantiate a new fluvio client
const fluvio = await Fluvio.connect();

//// Fluvio Admin Client

// Create a new Fluvio Admin Client to manage
// topics and partitions
const admin = await fluvio.admin();

// Create a new topic
await admin.createTopic(TOPIC_NAME)

//// Topic Producer

// Create a topic producer for the topic;
const producer = await fluvio.topicProducer(TOPIC_NAME);

// Send a new topic record
producer.sendRecord("stringified data", PARTITION)

//// Partition Consumer

// Instantiate a new topic listener;
const consumer = await fluvio.partitionConsumer(TOPIC_NAME, PARTITION)

// Listen for new topics sent by a topic producer;
await consumer.stream(async (data: string) => {
  // handle data record
})

Please look at ./examples and ./test folder for more detailed examples.

Demo Applications

Writing an application and considering using Fluvio? Check out the ./demos folder for example applications using the fluvio node client.

Apps:

Contributing

If you'd like to contribute to the project, please read our Contributing guide.

License

This project is licensed under the Apache license. Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in Fluvio Client by you, shall be licensed as Apache, without any additional terms or conditions.

Index

Variables

Const DEFAULT_HOST

DEFAULT_HOST: "127.0.0.1" = '127.0.0.1'

Const DEFAULT_ID

DEFAULT_ID: 0 = 0

Const DEFAULT_IGNORE_RACK_ASSIGNMENT

DEFAULT_IGNORE_RACK_ASSIGNMENT: false = false

Const DEFAULT_MIN_ID

DEFAULT_MIN_ID: 0 = 0

Const DEFAULT_OFFSET

DEFAULT_OFFSET: 0 = 0

Const DEFAULT_OFFSET_FROM

DEFAULT_OFFSET_FROM: "end" = 'end'

Const DEFAULT_PARTITIONS

DEFAULT_PARTITIONS: 1 = 1

Const DEFAULT_PORT

DEFAULT_PORT: 9003 = 9003

Const DEFAULT_PRIVATE_PORT

DEFAULT_PRIVATE_PORT: 9006 = 9006

Const DEFAULT_PUBLIC_PORT

DEFAULT_PUBLIC_PORT: 9005 = 9005

Const DEFAULT_REPLICAS

DEFAULT_REPLICAS: 3 = 3

Const DEFAULT_REPLICATION_FACTOR

DEFAULT_REPLICATION_FACTOR: 1 = 1

Const DEFAULT_TOPIC

DEFAULT_TOPIC: "message" = 'message'

Const PartitionConsumerJS

PartitionConsumerJS: any = ...

Functions

arrayBufferToString

  • arrayBufferToString(data: ArrayBuffer): string
  • Parameters

    • data: ArrayBuffer

    Returns string

stringToArrayBuffer

  • stringToArrayBuffer(data: string): ArrayBuffer
  • Parameters

    • data: string

    Returns ArrayBuffer

Legend

  • Constructor
  • Property
  • Method
  • Property
  • Method
  • Private property
  • Private method
  • Static method

Generated using TypeDoc