0.1.6 • Published 1 year ago

kafka-connector v0.1.6

Weekly downloads
-
License
UNLICENSED
Repository
-
Last release
1 year 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

1 year ago

0.1.5

1 year ago

0.1.4

1 year ago

0.1.3

1 year ago

0.1.2

1 year ago

0.1.1

1 year ago

0.1.0

1 year ago

0.0.9

2 years ago

0.0.8

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.1

2 years ago

0.0.2

2 years ago