-
Notifications
You must be signed in to change notification settings - Fork 915
Added Consumer.store_offsets() API #245
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
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.
Great stuff!
miniscule changes needed
confluent_kafka/src/Consumer.c
Outdated
c_offsets = rd_kafka_topic_partition_list_new(1); | ||
rd_kafka_topic_partition_list_add( | ||
c_offsets, cfl_PyUnistr_AsUTF8(m->topic, &uo8), | ||
m->partition)->offset =m->offset + 1; |
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.
nit: space after =
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.
fixed
confluent_kafka/src/Consumer.c
Outdated
|
||
err = rd_kafka_offsets_store(self->rk, c_offsets); | ||
|
||
if (c_offsets) |
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.
this is always true
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.
That's true, fixed!
Guard rd_kafka_offsets_store() inside version check (implicit-function-declaration)
confluent_kafka/src/Consumer.c
Outdated
@@ -341,7 +341,7 @@ static PyObject *Consumer_store_offsets (Handle *self, PyObject *args, | |||
"buildtime 0x%x)", | |||
rd_kafka_version(), RD_KAFKA_VERSION); | |||
return NULL; | |||
#endif | |||
#else |
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 catch
confluent_kafka/src/Consumer.c
Outdated
@@ -341,7 +341,7 @@ static PyObject *Consumer_store_offsets (Handle *self, PyObject *args, | |||
"buildtime 0x%x)", | |||
rd_kafka_version(), RD_KAFKA_VERSION); | |||
return NULL; | |||
#endif |
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.
With this #else guard the variables defined above will be unused and produce warnings.
I suggest moving the variable decls down to the #else block.
Avoid declaring unused variables & relavant warnings
The thread test failure is not your fault, ignore it. |
Thanks for this! |
Hello all,
This PR implements the
Cosumer.store_offsets()
API. The signature is similar to the.commit()
method.