-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Best approach to read messages from multiple topics or partitions #322
Comments
I am not sure if I get you correct. |
Thanks DEvil0000. Regarding B, i see TCP connection established between even consumers and brokers which are not leaders for the topic. And I see all the C++ APIs are wrappers over C API, so behavior should be same whether we use C /C++. My question B was if using same kafka handle i.e. "RdKafka::Consumer *consumer = RdKafka::Consumer::create(conf, errstr);" call in C++, can we consume messages from different topics. I am unable to figure out how to achieve this if at all possible. If yes, it will save on number of TCP connections consumer has to maintain. Would be useful if we want to read all data in one single thread. Regarding question C, if max value of int64_t is exceeded, it might reset. But is there any other logic. Could not find any write-up on this, so was my question. Surely, Consumer has to manage offset on its side. |
A B C |
The C++ interface is currently lagging behind somewhat and does not feature the queue interface. |
Thanks a lot edenhill. I tried to consume multiple topics using same handle. Modified rdkafka_example.c as follows, but getting core dump on second rd_kafka_topic_new. Will try to debug more. While doing gdb, I see following code being run from multiple threads (2)
..................
|
On 3 July 2015 at 18:05, rathdeep [email protected] wrote:
I think this happens because rd_kafka_topic_new frees topic_conf, so you |
Thanks yungchin. |
Hi,
I have few questions which I want to ask this community.
A>>>>>>>>>>>
I have gone through some threads on reading from different partitions of a topic.
Which approach is better:
1>Redirect messages from different partitions to the shared queue (rd_kafka_queue_new).
Or
2> Without shared queue instead directly calling rd_kafka_consume_start on each partition. Then register same callback method using rd_kafka_consume_callback for each partition.
B>>>>>>>>>>>
After running above scenario, I saw one set of TCP connections between consumer and each of the brokers of the topic. Basically, with creation of one Kafka handle via following API call
rd_kafka_new(RD_KAFKA_CONSUMER, conf,
errstr, sizeof(errstr)))
Using this Kafka handle, I consumed messages from all partitions of a topic.
If I want to read messages from another topic, is it possible to reuse the same Kafka handle created above (so that number of TCP connections are limited) ?
Creating a new Kafka handle per topic works.
C>>>>>>>>>>>
A generic question regarding Kafka. Do you know when a offset for a partition gets reset to 0.
Thanks in advance for your responses.
The text was updated successfully, but these errors were encountered: