post-json-to-kafka

1.0.0 • Public • Published

Publish list of object to kafka

XO code style

Install

yarn add post-json-to-kafka

# or

npm install --save post-json-to-kafka

Configuring

The location of kafka can be set by the environment variable:

KAFKA_URL=localhost:9092 # default

Example usage

const {sendToKafka} = require('post-json-to-kafka');

const exampleFunction = async () => {
  const somethingToAddInsideEachMessage = 'what you want string, object, list, number';
  const listOfJSON = [
    {key: 'value', key2: 'value2'},
    {key: 'value', something: 'value'}
  ];
  
   
  await sendToKafka('topic', somethingToAddInsideEachMessage, listOfJSON)
};

exampleFunction().then(() => {console.log('Everything is sent')});

Debugging

This package uses the debug package. You can configure it with environment variables:

DEBUG=post-json-to-kafka:debug # only debug messages
DEBUG=post-json-to-kafka:trace # only trace messages
DEBUG=post-json-to-kafka:*     # every messages

Readme

Keywords

none

Package Sidebar

Install

npm i post-json-to-kafka

Weekly Downloads

0

Version

1.0.0

License

MIT

Unpacked Size

3.12 kB

Total Files

6

Last publish

Collaborators

  • waxo