DariusX commented on a change in pull request #3877:
URL: https://github.com/apache/camel/pull/3877#discussion_r432950461



##########
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:
       Thank you for pointing that out. I was going by the comments in the JIRA.
   Since the partition is being revoked, I think it is fine to clear it out 
always, not just on the exception. 
   https://issues.apache.org/jira/browse/CAMEL-14935
   
   But, I will double-check with the reporter of the JIRA too. 




----------------------------------------------------------------
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


Reply via email to