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



##########
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);

Review comment:
       What if you move the clear up here, and remove it from finally. Then its 
only cleared when there is an exception. And on success then the code below 
will only remove the current offset key, which seems correct to me.




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