I'm writing a kafka consumer using confluent-kafka in Python. I'm using the asynccommit API. The documentation for the on_commit callback says the following. I don't understand the different between the First error argument and the individual errors within each TopicPartition argument. Can someone show me an example of how to handle this callback?
on_commit(kafka.KafkaError, list(kafka.TopicPartition))
(Consumer): Callback used to indicate success or failure of asynchronous and automatic commit requests. This callback is served upon callingconsumer.poll()
. Is not triggered for synchronous commits. Callback arguments: KafkaError is the commit error, or None on success. list(TopicPartition) is the list of partitions with their committed offsets or per-partition errors.
What would the arguments look like if
- there was no error
- there were some errors
- all of them errored out
First param would be
None
, as well as all TopicPartition.errorSome
TopicPartition.error
would beNone
. Everything else would not.All errors would be not None