1.0.0 • Published 5 years ago

post-json-to-kafka v1.0.0

Weekly downloads
2
License
MIT
Repository
github
Last release
5 years ago

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
1.0.0

5 years ago

0.1.0

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago