2

what's the purpose of the disconnect functions in kafkajs?

const producer = kafka.producer()

await producer.connect()
await producer.send({
  topic: 'test-topic',
  messages: [
    { value: 'Hello KafkaJS user!' },
  ],
})

await producer.disconnect()

what happens if I don't call it at the end of my program?

is it only a flush / memory leak thing or does it impact the kafka side as well?

couldn't find any description of it in the kafkajs docs.

Uri
  • 25,622
  • 10
  • 45
  • 72

0 Answers0