Skip to content

Two consumers belong to the same group get the same message #270

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

Closed
wangxiangyu opened this issue Dec 3, 2014 · 3 comments
Closed

Two consumers belong to the same group get the same message #270

wangxiangyu opened this issue Dec 3, 2014 · 3 comments

Comments

@wangxiangyu
Copy link

hi,
I use SimpleConsumer to consume message , but I find that "Two consumers belong to the same group get the same message ".
My code is: https://gist.github.com/wangxiangyu/2fb73be1266fd74cd9e5
I read the code briefly, I cant find the code which is used to ensure this character.
Thank you!

@dpkp
Copy link
Owner

dpkp commented Dec 3, 2014

Consumer coordination is currently not supported by kafka-python. See Issue #38 . This feature requires either (1) custom client-side coordination via Zookeeper/Etcd/Consul, or (2) wait until kafka-server adds coordination API support. As much as I'd love to write an etcd/consul powered coordination layer, we'll probably end up waiting until kafka-server supports this. I believe that is expected in apache kafka 0.9.0 or possibly even 0.8.2

@dpkp dpkp closed this as completed Dec 3, 2014
@se7entyse7en
Copy link
Contributor

I emulate this by creating a SimpleConsumer with auto_commit=False and by calling fetch_last_known_offsets() before each read and commit() after.

@dpkp
Copy link
Owner

dpkp commented Dec 3, 2014

a better emulation would be to assign consumers to partitions explicitly. As long as you have a consumer group in which no two consumers read from the same partition, you should not see duplicate message processing. The complexity arises when you want the client code to manage partition assignment dynamically, and additionally support add/removing consumers from the group.

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