-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[client][python] Add support for consumer get_last_message_id #15993
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
[client][python] Add support for consumer get_last_message_id #15993
Conversation
|
@michaeljmarshall:Thanks for your contribution. For this PR, do we need to update docs? |
| /** | ||
| * Get the latest message id for the consumer's topic. | ||
| */ | ||
| virtual void getLastMessageIdAsync(BrokerGetLastMessageIdCallback callback); |
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.
BrokerGetLastMessageIdCallback is an internal callback definition defined in ConsumerImpl.h, you should define your own callback. See include/pulsar/Reader.h for how it defines the getLastMessageIdAsync. And there is no need to make it virtual.
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.
Thank you for your guidance! I'll take a look at that.
|
|
||
| for i in range(10): | ||
| producer.send(b"hello-%d" % i) | ||
| message_id = consumer.get_last_message_id() |
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.
we should add a test with a empty topic
possibly we should cover the case of a truncated topic, but I am not sure we have a API to truncate a topic in python. not a blocker
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.
Sure, I can cover that test too. I need to address the underlying C++ first, though.
### Motivation Add getLastMessageId method to C++ Consumer.cc to address the missing part in this PR #15993 ### Modifications Expose methods to get last message Id in consumer, the C++ client's Consumer class
|
Looks like this is superseded by one or more PRs. I'll close this for now. |
Fixes #15985
Motivation
Add the
get_last_message_idmethod to the python consumer. This method is already present in the C++ client.Modifications
consumer.ccVerifying this change
There is a test to verify this change.
Does this pull request potentially affect one of the following parts:
It expands the python client library.
Documentation
Docs will be auto-generated for this addition.