ceejay66 commented on a change in pull request #3877: URL: https://github.com/apache/camel/pull/3877#discussion_r432991029
########## File path: components/camel-kafka/src/main/java/org/apache/camel/component/kafka/KafkaConsumer.java ########## @@ -460,7 +460,14 @@ public void onPartitionsRevoked(Collection<TopicPartition> partitions) { offset = -1L; } LOG.debug("Saving offset repository state {} from offsetKey {} with offset: {}", threadId, offsetKey, offset); - commitOffset(offsetRepository, partition, offset, true); + try { + commitOffset(offsetRepository, partition, offset, true); + } catch (java.lang.Exception e) { + LOG.error("Error saving offset repository state {} from offsetKey {} with offset: {}", threadId, offsetKey, offset); + throw e; + } finally { + lastProcessedOffset.clear(); Review comment: Yes removal is required on success as previously. This fixes an issue where an exception on commit prevents the map entry being removed - leading to old offsets being committed. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org