Skip to content

Commit 1e0503b

Browse files
[feature][client-cpp] Support inclusive seek for cpp client (#17209)
Fixes #17186 ### Motivation There are some cases in which it is useful to be able to include current position of the message when reset of cursor was made. ### Modifications * Support inclusive seek in c++ consumers. * Add a unit test to verify.
1 parent ede2e97 commit 1e0503b

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

pulsar_test.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -546,7 +546,7 @@ def test_reader_on_specific_message(self):
546546
# The reset would be effectively done on the next position relative to reset.
547547
# When available, we should test this behaviour with `startMessageIdInclusive` opt.
548548
from_msg_idx = last_msg_idx
549-
for i in range(from_msg_idx, num_of_msgs):
549+
for i in range(from_msg_idx + 1, num_of_msgs):
550550
msg = reader2.read_next(TM)
551551
self.assertTrue(msg)
552552
self.assertEqual(msg.data(), b"hello-%d" % i)
@@ -896,7 +896,7 @@ def test_seek(self):
896896
consumer.seek(ids[50])
897897
time.sleep(0.5)
898898
msg = consumer.receive(TM)
899-
self.assertEqual(msg.data(), b"hello-50")
899+
self.assertEqual(msg.data(), b"hello-51")
900900

901901
# ditto, but seek on timestamp
902902
consumer.seek(timestamps[42])
@@ -921,9 +921,9 @@ def test_seek(self):
921921
reader.seek(ids[33])
922922
time.sleep(0.5)
923923
msg = reader.read_next(TM)
924-
self.assertEqual(msg.data(), b"hello-33")
925-
msg = reader.read_next(TM)
926924
self.assertEqual(msg.data(), b"hello-34")
925+
msg = reader.read_next(TM)
926+
self.assertEqual(msg.data(), b"hello-35")
927927

928928
# seek on timestamp
929929
reader.seek(timestamps[79])

0 commit comments

Comments
 (0)