You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
const{ Producer }=require('node-rdkafka');asyncfunctionproduce(){constproducer=newProducer({'client.id': 'client-id','metadata.broker.list': 'localhost:9092',});awaitproducer.connect();// ...wait for readinessproducer.produce('local.ssh-sender',null,Buffer.from('Hello Kafka!'),'key',Date.now());process.exit(0)}produce();
Additional context
This code will never send the message in the kafka queue because producer.produce is not a promise so process.exit will be executed (almost) at the same time
The text was updated successfully, but these errors were encountered:
While it's true that it would be a nice to have produce returning a promise, it also accepts a callback. You can wrap the call in a new Promise and then you can await on it.
Environment Information
Steps to Reproduce
Additional context
This code will never send the message in the kafka queue because
producer.produce
is not a promise soprocess.exit
will be executed (almost) at the same timeThe text was updated successfully, but these errors were encountered: