Blizzard / Blizzard/node-rdkafka

producer.produce should be a promise

Open
#1,094 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
2.2k
Forks
403
PR merge metrics
No merged PRs in 30d

Description

**Environment Information**
- node-rdkafka version: 3.1.0

**Steps to Reproduce**

```js
const { Producer } = require('node-rdkafka');

async function produce() {
const producer = new Producer({
'client.id': 'client-id',
'metadata.broker.list': 'localhost:9092',
});
await producer.connect();
// ...wait for readiness
producer.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

Contributor guide

Open the contributing guide

Research direction

Start at the producer.produce API entry point and reproduce the provided Node.js example with a local Kafka broker. Trace how produce reports completion and identify the relevant existing tests or binding code. Done means the example can await produce without exiting before the message is sent.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, kafka, node.js
Domain
api, backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.