danieljoos / libkafka-asio

C++ Kafka Client Library using Boost Asio
MIT License
76 stars 40 forks source link

What if I want to use client to connect multiple brokers? #23

Open felixguo opened 8 years ago

felixguo commented 8 years ago

Hi, guys:

You guys really did a great work, really appreciate your time and talent of contributing to the open source world. I recently play with the client and found there is no way of using multiple brokers for producer. What if the broker service is unavailable and need to be OOO? I am thinking of adding this support to the code. Let me know if I am wrong, there is actually a way of using multiple brokers.

Thanks, Zhongqi

danieljoos commented 8 years ago

Hi Zhongqi,

Yes, you're right. The library is completely missing that part. Kafka needs quite some logic implemented on the client side. A client needs to hold some metdata about all known brokers and also needs to update that data once in a while. Furthermore, it requires at least one connection to each of those brokers. The client is also free to choose how to distribute messages across the partitions of a topic (e.g. round-robin,...).

So, a client implementation would require some piece that holds and updates the broker metadata as well as the actual producer/consumer implementation. I really like the way, it is implemented in the official Kafka Java client: https://github.com/apache/kafka/tree/trunk/clients/src/main/java/org/apache/kafka/clients

It would be awesome, if you participate in this project.

I'm working on my Master's thesis at the moment and don't find much time for other stuff. Contributions are always welcome!

Best regards, Daniel