I have installed kafkajs package using the command npm install kafkajs
but ember can’t found Kafka package.
I got this exception
Source Code
**const { Kafka } = require(‘kafkajs’)
const kafka = new Kafka({ clientId: ‘my-app’, brokers: [‘kafka1:9092’, ‘kafka2:9092’] })
const producer = kafka.producer() const consumer = kafka.consumer({ groupId: ‘test-group’ })
const run = async () => { // Producing await producer.connect() await producer.send({ topic: ‘test-topic’, messages: [ { value: ‘Hello KafkaJS user!’ }, ], })
// Consuming await consumer.connect() await consumer.subscribe({ topic: ‘test-topic’, fromBeginning: true })
await consumer.run({ eachMessage: async ({ topic, partition, message }) => { console.log({ partition, offset: message.offset, value: message.value.toString(), }) }, }) }**