changhc commented on code in PR #2169:
URL: https://github.com/apache/iggy/pull/2169#discussion_r2349965563


##########
foreign/python/src/consumer.rs:
##########
@@ -129,6 +130,13 @@ impl IggyConsumer {
         })
     }
 
+    /// Asynchronously iterate over `ReceiveMessage`s.
+    
#[gen_stub(override_return_type(type_repr="collections.abc.AsyncIterator[ReceiveMessage]",
 imports=("collections.abc")))]
+    fn iter<'a>(&self) -> ReceiveMessageIterator {

Review Comment:
   I thought about this again and now I think it's better not to allow users to 
iterate through the consumer itself as that can be confusing. This `iter` 
method can probably be named as `read_messages` for clarity as it seems to be 
reading messages only instead of consuming them.
   
   Also, what is the expected behaviour?
   ```
   count = 0
   async for message in consumer.iter():
       # read messages 0 to 4
       count += 1
       if count == 5:
           break
   # call it again
   async for message in consumer.iter():
       # reads message 5 or 0?
       break
   ````
   
   If this method changes the consumer state, we need to make this clear.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to