confluent-kafka-python
confluent-kafka-python copied to clipboard
Consumer poll() return None if the value of the message is None
According to the doc, poll() only returns None in the timeout situation. I notice that poll() also returns None if the value of the message is None. Is this an expected behavior?
p = Producer({'bootstrap.servers': 'mybroker1,mybroker2'})
p.produce('mytopic', None)
p.flush()
c = Consumer({
'bootstrap.servers': 'mybroker',
'group.id': 'mygroup',
'auto.offset.reset': 'earliest'
})
low, high = c.get_watermark_offsets(TopicPartition('mytopic', 0), timeout=TIMEOUT)
c.assign([TopicPartition('mytopic', 0, high - 1)])
c.poll(timeout=TIMEOUT) => Get None instead of a Message object with None as value
Hi @hrchu, thanks for asking.
I think Poll returns None means it doesn't get anything. I tried on my local, what I got is Message Object even though the message value is None:
tests % python consumer1270.py
<cimpl.Message object at 0x7faa90014240>
I saw your producer doesn't have a delivery report, not sure if your message is delivered or not.
I notice that poll() also returns None if the value of the message is None. Is this an expected behavior?
no. something else is going on, that should never happen.