asinino / node-red-kafkajs

A package to comunicate with a Kafka server and lets the user control the flow of message pipeline to control success and failure on message synchronization.
GNU General Public License v3.0
0 stars 1 forks source link

node-red-kafkajs

[Note]

This repo is highly inspired on the repo at: https://github.com/amey0309/node-red-contrib-kafkajs It also depends on KafkaJS to do the basic functionality, you can find more info at: https://kafka.js.org/


[Note 2]

KAFKA is a registered trademark of The Apache Software Foundation. This project has no affiliation with and is not endorsed by The Apache Software Foundation.


With these nodes you can consume and produce messages to the Kafka broker and the big difference between this and the other projects found at Node-RED is better handling errors and node outputs to notify events. As the project at the top of this document, these nodes are a wrapper of the library KafkaJS, and it just pipes the data to the provided functionality of that library.

This library provides 3 nodes to make basic communication:

It lets the flow send data to the Kafka Broker in the desired format and allows the user to send a Buffer object as the key and value of the message, this allows your flows to communicate with native data types if needed. It also provides a list of types that it can serialize automatically without the need to create an extra node for the data conversion, including serializing to JSON.

Advanced authentication is still missing tests, I'm rellying on the background projects.

Input Parameters

kafkajs-broker

Authentication

  * CA Certs (Optional)

CA Root certificate path defined in Kafka Cluster.

  * Client Cert (Optional)

Client cert path created by OpenSSL derived from Private Key (pem).

  * Private Key (Optional)

Private Key path created by OpenSSL (pem).

  * Passphare (Optional)

A passphrase of created Private Key.

  * Mechanism

The method used to send authentication data to the server.

  * Username

Username to connect to Kafka Cluster.

  * Password

Password to connect to Kafka Cluster.

  * Use SSL

Activate SSL Connection.

Advanced Retry Options

Advanced Retry Options of Kafka Client.

kafkajs-producer

The node can receive a message (msg object above payload) with the following properties:

If some of these msg properties are set on the properties node, the node properties will prevail.

The node also provides two outputs so the flow can continue or react if the node succeeds or fails to send the message to the broker, this allows to cache of the messages not sent to be sent later or to log the error (the catch node will also trigger if any error is thrown by the node). The node outputs are:

  1. Triggered when the message was successfully sent.
  2. Triggered when some error occurred to send the message.

kafkajs-consumer

Installation

npm install @asinino/node-red-kafkajs

Screenshots

kafkajs-broker

kafkajs-consumer

kafkajs-producer

example-flow