Skip to content
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

When consuming, how to let kafka choose the partitions? #42

Closed
veqryn opened this issue Nov 2, 2017 · 4 comments
Closed

When consuming, how to let kafka choose the partitions? #42

veqryn opened this issue Nov 2, 2017 · 4 comments

Comments

@veqryn
Copy link

veqryn commented Nov 2, 2017

This library appears to force you to specify which partition you are consuming from when you want to fetch messages.

Kafka is supposed to do that for you.
Kafka looks at how many partitions there are in a topic, and how many consumers are currently in the consumer group, and then rebalancing the number of partitions that are being sent to each consumer.
So if you have 4 partitions, and only 2 consumers, then kafka will send messages from 2 partitions to each consumer as they request messages, without the consumers needing to know about the partitions when they fetch messages. If 2 more consumers get added, kafka will rebalance automatically so that each consumer gets its own partition, that way two consumers within a group are never using the same partition.

How do I do this with this library?

@asolovey
Copy link
Contributor

asolovey commented Nov 3, 2017

Duplicate of #2.

This module does not implement high-level consumer API including consumer groups. Initially, the issue was with Zookeeper, because for Kafka versions < 0.9 the high-level API required working with Zookeeper directly and in Perl it is kind of tricky. Recent versions of Kafka (0.10+ I believe) do not require Zookeeper and all relevant data is available via broker connection. However there is no plans to implement this yet.

As a side note, our experience shows that such high-level partitioning logic may work better if implemented on application level instead of relying on some Kafka "magic". YMMV.

@veqryn
Copy link
Author

veqryn commented Nov 3, 2017

That is unfortunate.
Expecting users to implement their own distributed partition locking is a big ask, especially when it comes with Kafka and all other languages I've used have libraries with balanced consumers.

@hamshif
Copy link

hamshif commented Sep 22, 2019

@veqryn @asolovey was a consumer group implemented in perl?

@asolovey
Copy link
Contributor

This module does not support consumer groups. Unfortunately, there is no plans to work on this feature for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants