@@ -74,6 +74,28 @@ async def test_commit_offset_works(self, driver, topic_with_messages, topic_cons
74
74
topic_with_messages , topic_consumer , message .partition_id , message .offset + 1
75
75
)
76
76
77
+ async def test_commit_offset_with_session_id_works (self , driver , topic_with_messages , topic_consumer ):
78
+ async with driver .topic_client .reader (topic_with_messages , topic_consumer ) as reader :
79
+ msg1 = await reader .receive_message ()
80
+ assert msg1 .seqno == 1
81
+ msg2 = await reader .receive_message ()
82
+ assert msg2 .seqno == 2
83
+
84
+ await driver .topic_client .commit_offset (
85
+ topic_with_messages ,
86
+ topic_consumer ,
87
+ msg1 .partition_id ,
88
+ msg1 .offset + 1 ,
89
+ reader .read_session_id ,
90
+ )
91
+
92
+ msg3 = await reader .receive_message ()
93
+ assert msg3 .seqno == 3
94
+
95
+ async with driver .topic_client .reader (topic_with_messages , topic_consumer ) as reader :
96
+ msg2 = await reader .receive_message ()
97
+ assert msg2 .seqno == 2
98
+
77
99
async def test_reader_reconnect_after_commit_offset (self , driver , topic_with_messages , topic_consumer ):
78
100
async with driver .topic_client .reader (topic_with_messages , topic_consumer ) as reader :
79
101
for out in ["123" , "456" , "789" , "0" ]:
@@ -213,6 +235,28 @@ def test_commit_offset_works(self, driver_sync, topic_with_messages, topic_consu
213
235
topic_with_messages , topic_consumer , message .partition_id , message .offset + 1
214
236
)
215
237
238
+ def test_commit_offset_with_session_id_works (self , driver_sync , topic_with_messages , topic_consumer ):
239
+ with driver_sync .topic_client .reader (topic_with_messages , topic_consumer ) as reader :
240
+ msg1 = reader .receive_message ()
241
+ assert msg1 .seqno == 1
242
+ msg2 = reader .receive_message ()
243
+ assert msg2 .seqno == 2
244
+
245
+ driver_sync .topic_client .commit_offset (
246
+ topic_with_messages ,
247
+ topic_consumer ,
248
+ msg1 .partition_id ,
249
+ msg1 .offset + 1 ,
250
+ reader .read_session_id ,
251
+ )
252
+
253
+ msg3 = reader .receive_message ()
254
+ assert msg3 .seqno == 3
255
+
256
+ with driver_sync .topic_client .reader (topic_with_messages , topic_consumer ) as reader :
257
+ msg2 = reader .receive_message ()
258
+ assert msg2 .seqno == 2
259
+
216
260
def test_reader_reconnect_after_commit_offset (self , driver_sync , topic_with_messages , topic_consumer ):
217
261
with driver_sync .topic_client .reader (topic_with_messages , topic_consumer ) as reader :
218
262
for out in ["123" , "456" , "789" , "0" ]:
0 commit comments