node-rdkafka icon indicating copy to clipboard operation
node-rdkafka copied to clipboard

Question: Does node-rdkafka support asynchronous produce?

Open choudhary001 opened this issue 6 years ago • 3 comments

It is more of a question and not a bug report. I was looking at the Producer documentation and the documentation for produce says that it produces messages to kafka synchronously.

Is asynchronous produce not support? If it is how can i achieve it, I didn't find any example in docs.

Thanks!

choudhary001 avatar Apr 07 '20 12:04 choudhary001

All produce methods are async in a sense that the message is not synchronously written to Kafka but just queued into a buffer. If you need callback when your message gets to the Kafka you can use HighLevelProducer and its produce method.

iradul avatar Apr 08 '20 01:04 iradul

Then why does the documentation says it produces messages synchronously.

Copied from https://blizzard.github.io/node-rdkafka/current/Producer.html

produce(topic, partition, message, key, timestamp, opaque) → {boolean} Produce a message to Kafka synchronously. This is the method mainly used in this class. Use it to produce a message to Kafka. The first and only parameter of the synchronous variant is the message object. When this is sent off, there is no guarantee it is delivered. If you need guaranteed delivery, change your acks settings, or use delivery reports.

choudhary001 avatar Apr 09 '20 08:04 choudhary001

I'm not sure what that is but the only valid and maintained documentation is README.md

iradul avatar Apr 09 '20 17:04 iradul