-
Notifications
You must be signed in to change notification settings - Fork 906
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Provide the whole batch of messages in the Consumer's API #343
Comments
The notion of Kafka batches has little meaning to the application and is thus abstracted. |
OK, however I have some trouble when collecting the messages by repeatedly calling poll(). I have a function called Suppose it's collecting messages, it has called poll() five times and got five messages, and while it's polling a sixth time there's an error. What is it going to do? If it raises an exception, there's the danger that these five messages are going to be committed although they have never been used. (We use autocommit=False, however If it ignores the error and returns the list of five messages, well, that's a bit ugly, isn't it? I don't like pretending that everything was done successfully in the presence of an error (and pray that next time |
It is not possible to put messages back on the consumer queue, but you can control what messages are to be committed by disable enable.auto.offset.store and explicitly calling store_offsets() when you want to increase the high watermark of messages processed. More info: |
Getting messages in batches seems to have been fixed in #252. |
My understanding is that the
librdkafka
consumer reads data in batches into a buffer, and in Pythonpoll()
provides items from the buffer one by one. But the logic in my program requires data to be read in batches. So I've implemented a wrapper aroundpoll()
that calls it many times in order to provide a batch. But this seems silly when I could just get hold of the original batch; and besides silly, it's hard to make it work well in all the cases.The text was updated successfully, but these errors were encountered: