Added some comments about message state

This commit is contained in:
Mahendra M
2013-06-25 17:06:16 +05:30
parent b022be28de
commit 99da57f98a

View File

@@ -365,6 +365,13 @@ class SimpleConsumer(Consumer):
next_offset = None
for message in resp.messages:
next_offset = message.offset
# update the offset before the message is yielded. This is
# so that the consumer state is not lost in certain cases.
# For eg: the message is yielded and consumed by the caller,
# but the caller does not come back into the generator again.
# The message will be consumed but the status will not be
# updated in the consumer
self.offsets[partition] = message.offset
yield message
if next_offset is None: