0

My python confluent kafka code to read from the Kafka broker looks as below

self.consumer = Consumer(
            {
                "auto.offset.reset": "earliest",
                "enable.auto.commit": False,
            }
        )

while True:
        msg = self.consumer.poll(timeout=5)
        log.info(f"Before commit  {msg.topic()} {msg.partition()} 
        {msg.offset()}")
        #Before commit  stream-seg 2 6476

        self.consumer.commit(asynchronous=False)

        log.info(f"After commit  {msg.topic()} {msg.partition()} 
        {msg.offset()}")
        #After commit  stream-seg 2 6476

As seen above the msg.offset() before and after commit is same. Should I commit the offset value/partition also while doing the consumer.commit() or am I missing something

OneCricketeer
  • 179,855
  • 19
  • 132
  • 245
Zaks
  • 668
  • 1
  • 8
  • 30

1 Answers1

1

You never change the msg variable, so there is no modification done to its attributes as a side-effect of committing.

OneCricketeer
  • 179,855
  • 19
  • 132
  • 245