librdkafka
librdkafka copied to clipboard
Key given in producer through librdkafka mismatches to consume on right nodejs consumer
Read the FAQ first: https://github.com/edenhill/librdkafka/wiki/FAQ
Do NOT create issues for questions, use the discussion forum: https://github.com/edenhill/librdkafka/discussions
Description
The c++ producer using librdkafka producing messages on a topic name and key, is produced to a partition which is not same as a nodejs producer (kafka library) producing on the same topic and key.
We see, consumers written in nodejs (kafkajs library) consuming messages on different partition from messages produced from c++ librdkafka and from nodejs producer ( through kafkajs).
How to reproduce
- We use latest librdkafka version from git repo, built in linux and produce messages on a particular topic.
- This c++ producer produces on a topic called "voice-test" and key called "testkey" (for example)
- Then through nodejs, another producer (written in library kafkajs) sends messages to kafak on same topic "voice-test" and same key "testkey"
- Now, I start two consumers in nodejs (through kafkajs library) to consume messages on the topic "vocie-test" whereas c++ produced messages are consumed in consumer 1 and nodejs producer is consumed in consumer 2
- Ideally, we expect one consumer to consume all the messages on voice-test from same key "testkey" but we see how c++ client sends the message on different partition is conflicting with nodejs producer sending to different partition
How we resolved this:
- Either use node-rdkadka nodejs library to produce which is compatible in terms of key allocation to right partition with c++ librakafka producer.
- Another old approach is, we made nodejs producer to modify the key with ENCODED DOUBLE QUOTES '"testkey"' which makes it compatiable with c++ producer logic.
Checklist
IMPORTANT: We will close issues where the checklist has not been completed.
Please provide the following information:
- [x] librdkafka version (release number or git tag):
<REPLACE with e.g., v0.10.5 or a git sha. NOT "latest" or "current"> - [ ] Apache Kafka version:
<REPLACE with e.g., 0.10.2.3> - [ ] librdkafka client configuration:
<REPLACE with e.g., message.timeout.ms=123, auto.reset.offset=earliest, ..> - [ ] Operating system:
<REPLACE with e.g., Centos 5 (x64)> - [ ] Provide logs (with
debug=..as necessary) from librdkafka - [ ] Provide broker log excerpts
- [ ] Critical issue