Issue with Java 17 and Apache Kafka: Messages Not Being Acknowledged in Consumer with Manual Commit
This might be a silly question, but This might be a silly question, but I'm facing an issue with my Kafka consumer setup using Java 17 and the Kafka client library version 3.4.0. My consumer is configured to use manual message acknowledgments, but it seems that messages are not being acknowledged properly after processing. I'm using the following configuration: ```java Properties props = new Properties(); props.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, "localhost:9092"); props.put(ConsumerConfig.GROUP_ID_CONFIG, "test-group"); props.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class.getName()); props.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class.getName()); props.put(ConsumerConfig.ENABLE_AUTO_COMMIT_CONFIG, false); ``` When I process messages in my `poll` loop, I call `commitSync()` for manual acknowledgment, but I'm still seeing the same messages being re-delivered. Hereβs how Iβm processing the messages: ```java while (true) { ConsumerRecords<String, String> records = consumer.poll(Duration.ofMillis(100)); for (ConsumerRecord<String, String> record : records) { System.out.printf("Consumed message with key %s and value %s%n", record.key(), record.value()); // Processing logic here // Acknowledge message manually consumer.commitSync(); } } ``` I've tried increasing the duration in `poll()` and also ensured that `commitSync()` is called after all processing is done, yet I'm still receiving duplicate messages. Additionally, I'm seeing logs like: ``` [Consumer clientId=consumer-1, groupId=test-group] Found no committed offsets for group test-group. ``` I'm not sure what I'm missing here. Could this be related to the consumer group configuration or is there something else that I should check? Any guidance would be appreciated! For context: I'm using Java on macOS. I'm working on a API that needs to handle this.