0.1.6 • Published 3 years ago

kafka-connector v0.1.6

Weekly downloads
-
License
UNLICENSED
Repository
-
Last release
3 years ago

Description

kafka-connectorA public TypeScript library for easy kafka producer and consumer.

Installation

$ npm i kafka-connector

How to use?

  Step 1 - Initilize KafkaManager, you can use custom host and port.
    this.kafkaManager = await KafkaManager.create(); // 
    await this.kafkaManager.initilize({ host: 'localhost', 'port': 29092});
 Step 2 - Consume existing topic
    await this.kafkaManager.consume(
      { topic: 'customtopic' }, {
      eachMessage: async ({ topic, partition, message }) => {
        console.log({
          topic: topic.toString(),
          partition: partition.toString(),
          value: message.value.toString()
        })
      }
    });
 Step 3 - Produce to existing or new topic
        await kafkaManager.produce({
            topic: 'customtopic', messages: [
                {
                    key: 'create user',
                    value: 'Hi, New event happended!!'
                }
            ]
        })

Test

# unit tests
$ npm run test

# e2e tests
$ npm run test:e2e

# test coverage
$ npm run test:cov

Stay in touch

License

Nest is MIT licensed.

0.1.6

3 years ago

0.1.5

3 years ago

0.1.4

3 years ago

0.1.3

3 years ago

0.1.2

3 years ago

0.1.1

3 years ago

0.1.0

3 years ago

0.0.9

3 years ago

0.0.8

3 years ago

0.0.7

3 years ago

0.0.6

3 years ago

0.0.5

3 years ago

0.0.4

3 years ago

0.0.1

3 years ago

0.0.2

3 years ago