[client][python] Add support for consumer get_last_message_id - #15993
[client][python] Add support for consumer get_last_message_id#15993michaeljmarshall wants to merge 5 commits into
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.
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.
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.
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.
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.