Class default

Fluvio TypeScript / NodeJS Client


The NodeJS client for communicating with Fluvio clusters.

Example Construction

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 = new Fluvio({
host: '',
port: 9003

// Explicitly connect to the fluvio cluster;
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.listen(async (data: RecordSet) => {
// handle data record

Uses Node Native Modules

TypeScript wrapper around native fluvio core module written in Rust.

Core module is generated from node-bindgen. This TypeScript wrapper provides type definitions and generates the JavaScript client.


  • default



  • Parameters

    • Optional options: Options

      Options provides top-level access to common configurable values used by the Fluvio client.

    Returns default


client?: FluvioClient
inner: any
options: Options


  • checkConnection(): void
  • Check to ensure this.client has been set. This method is used internally to check the connection status of the client before calling a method using the internal client.

    Returns void

  • Parameters

    • Optional options: Partial<Options>

      Optionally pass in connection host options (e.g. { host: '' }) uses the partial Options type; This does not override the default options, only replaces default options in this case;

    Returns Promise<FluvioClient>

  • Creates a new PartitionConsumer for the given topic and partition

    Currently, consumers are scoped to both a specific Fluvio topic and to a particular partition within that topic. That means that if you have a topic with multiple partitions, then in order to receive all of the events in all of the partitions, you will need to create one consumer per partition.


    • topic: string

      topic string

    • partition: number

      partition id

    Returns Promise<PartitionConsumer>

  • Creates a new TopicProducer for the given topic name

    Currently, producers are scoped to a specific Fluvio topic. That means when you send events via a producer, you must specify which partition each event should go to.


    • topic: string

      Name of the topic to create a producer for

    Returns Promise<TopicProducer>

  • Add static method to quickly create a connected client;


    • Optional options: Options

      Fluvio options passed into new fluvio instance;

    Returns Promise<default>

Generated using TypeDoc