how to stop kafka python consumer after getting a record I want to , and do my rest of the processes
I would like to consume all the messages from beginning each time I run the consumer in python and stop if I get a desired record and end the consumer then continue with rest of my processes.
You can use seek each time you start your consumer(use OFFSET_BEGINNING). This will set consume position for partition to offset. After this, keep processing messages as usual.
When you encounter the record after which you need to stop Consumer, use close