Question: How do I commit a partition?
See original GitHub issueUsing kafka-python-1.0.2.
If I have a topic with 10 partitions, how do I go about committing a particular partition, while looping through the various partitions and messages. I just cant seem find an example of this anywhere, in the docs or otherwise
From the docs, I want to use:
consumer.commit(offset=offsets)
Specifically, how do I create the partition and OffsetAndMetadata dictionary required for offsets (dict, optional) – {TopicPartition: OffsetAndMetadata}.
I was hoping the function call would just be something like:
consumer.commit(partition, offset),
but this does not seem to be the case.
Thanks in advance.
Issue Analytics
- State:
- Created 7 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
kafka-python - How do I commit a partition? - Stack Overflow
Find a better way to do it. topic_partition = TopicPartition(TOPIC, message.partition) consumer.seek(topic_partition, offset_value) consumer.
Read more >Kafka - When to commit? - Quarkus
It commits the offset, indicating that all the previous records from that partition have been processed. So, if a consumer stops and comes...
Read more >Apache Kafka Offset Management - Learning Journal
The offset is a position within a partition for the next message to be sent to a consumer. ... The answer to the...
Read more >Manually committing offsets in Kafka using .Net - Microsoft Q&A
I have a list of offsets with their corresponding partition and I need to commit them manually. To do so I am looping...
Read more >How to read from a specific offset and partition with the Kafka ...
Start a console consumer to read from the second partition ... In the previous step, you consumed records from the first partition of...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
the metadata is really just an opaque string. You can also pass
None
. Nothing uses metadata internally, it is there as a way for you to store application-specific data if needed. But very few folks actually use that functionality, so beware if you go down that path.@gyoga99 this is an old issue, better to file a new ticket. Reading your description, there is also a decent chance that this is a misunderstanding of how kafka works, so you might want to also post this as a question on stackoverflow, as we generally try to reserve the issue tracker for bugs and feature requests.Oops, looks like you posted https://github.com/dpkp/kafka-python/issues/1446 already