@fluvio/client

Node.js binding for Fluvio distributed stream

Usage no npm install needed!

<script type="module">
  import fluvioClient from 'https://cdn.skypack.dev/@fluvio/client';
</script>

README

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.