Comments (4)
When "rd_kafka_brokers_add" is called, it will request metadata from Kafka clusters. If the code "sleep(1)" is put after "rd_kafka_brokers_add", the topics information will be ignored when the broker threads receive metadata since "rd_kafka_topic_new" has not been called so far. (Here, the metadata must be received within one second after the request is sent.)
When "rd_kafka_topic_new" is called later, it will not request metadata from Kafka clusters again. Therefore, rdkafka can not send messages because it does not know to which broker the topic corresponds.
I guess you may make a mistake. The upper debug output you pasted above corresponds to the case that you add the code "sleep(1)" while the lower corresponds to the case without the "sleep".
You can see the output "Ignore unknown topic rb_event" in the upper debug infomation since "rd_kafka_topic_new" has not been called at that time. The output "new topic: rb_event" indicates the "rd_kafka_topic_new" is called later.
Solving this issue is easy. Just swap the position of "rd_kafka_topic_new" and "rd_kafka_brokers_add". Call "rd_kafka_topic_new" firstly and then call "rd_kafka_brokers_add". Now the code "sleep(1)" will not affect the result.
from librdkafka.
You are right in both auwzb. I swapped the debug output and I didn't realize I could just set the topic before the brokers. Anyway, I think the correct behavior is you can add a topic anywhere in the code, so I'll let the issue open by the moment.
Thanks a lot for the workaround!
from librdkafka.
Hi, eugpermar. I am glad that my comment helped.
You suggestion requires that rdkafka must request metadata when a topic is added.
from librdkafka.
I will push a fix for this soon.
from librdkafka.
Related Issues (20)
- Unable to build without SSL since #4721 HOT 3
- Not switching to a leader without leader epochs while doing a cluster roll to upgrade the cluster HOT 1
- Issue whie getting librdkafka from Nuget.org via V3 API HOT 1
- Build Failure: unknown type name 'rd_kafka_broker_t' in rdkafka_op.h HOT 2
- Fail to recover a partition which was temporarily delegated to the internal broker HOT 1
- ThreadSanitizer: data race + hang in rd_kafka_destroy (or rd_kafka_destroy_flags) HOT 1
- How to create a librdkafka.so file?
- Incorrect version of zlib packaged with windows version
- X
- can not be used when making a shared object; recompile with -fPIC
- When I was to send the message to kafka's service, the message content was lost when I have found it by kafkatool
- compile issue with "Use STATIC_LIB_libzstd=/path/to/libzstd.a "
- After the connection with the broker times out, there is no reconnection HOT 2
- Topic {X} partition count changed from {Y} to {Z} - for already deleted topic
- Some partitions occasionally fail to be consumed when a single client consumes multiple partitions. HOT 1
- timeout issue with async commit , we want to commit every message after consuming HOT 3
- librdkafka 2.2.0 uses system to run kinit and hence can receive SIGCHLD
- Error "Disconnected while requesting ApiVersion: might be caused by incorrect security.protocol configuration..." connecting to kafka broker 3.8.0 HOT 4
- Assert failing when none of KIP 714 requested metrics are implemented by librdkafka HOT 1
- warning: 'ENGINE_free' is deprecated: Since OpenSSL 3.0
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from librdkafka.