Closed
Description
When I want to commit only one message (a specific offset to a partition the message came from), I'm doing this:
from kafka import KafkaConsumer, OffsetAndMetadata
consumer = KafkaConsumer(TOPIC, enable_auto_commit=False)
message = consumer.poll(1000, max_records=1)
if message:
offsets = {list(message.keys())[0]:
OffsetAndMetadata(list(message.values())[0][0].offset + 1, '')}
consumer.commit(offsets)
I wonder if this makes sense and if there is a simpler way of getting the offset {TopicPartition: OffsetAndMetadata} for a message?
Have you considered to add something like message.commit() method?
Metadata
Metadata
Assignees
Labels
No labels