-
Notifications
You must be signed in to change notification settings - Fork 901
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
Support rd_kafka_memberid() from python clients #1154
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good stuff, needs some changes. Don't forget the CHANGELOG (Enhancement)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Almost there! Also add a CHANGELOG entry in the enhancement section
|
||
### Enhancements | ||
|
||
- Support rd_kafka_memberid() from python clients (#1154). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't expose the librdkafka name here, but the python one, so something like:
- Added consumer.memberid() method to retrieve the consumer's group member id (#1154)
consumer = kafka_cluster.consumer(consumer_conf) | ||
|
||
assert consumer is not None | ||
assert len(consumer.memberid()) == 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you should check that the memberid is None rather than have a 0 length (which could be an empty string or some other type).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi Magnus, thanks for reviewing.
I found that the consumer.memberid() is "" here when I do the test. But do you think None should be the expected result or "" is also Okay?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good question. I think it should be None as that seems more Pythonic.
consumer = kafka_cluster.consumer(consumer_conf) | ||
|
||
assert consumer is not None | ||
assert len(consumer.memberid()) == 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good question. I think it should be None as that seems more Pythonic.
Hi @jliunyu any chance this pr could make it into the 1.8.0 release? It would be quite handy for us. Thx |
Added support for consumer.memberid()
Created and merged a new PR for these changes - #1455 Closing this one. |
Added support for consumer.memberid()
Added support for consumer.memberid()
librdkafka has a rd_kafka_memberid() function, but it is not exposed in the Python client yet.
Local test: