You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2020/06/03 18:59:02 UTC
[camel] branch camel-2.25.x updated: Camel 14935 2.25.x (#3884)
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch camel-2.25.x
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/camel-2.25.x by this push:
new 5dd082e Camel 14935 2.25.x (#3884)
5dd082e is described below
commit 5dd082e13fdc7306c9fe82f44078a8a2e4e7bf60
Author: Darius <da...@gmail.com>
AuthorDate: Wed Jun 3 14:58:30 2020 -0400
Camel 14935 2.25.x (#3884)
* On partition-revoke, do the clearing of the offset inside a finally. That way, it will happen even if the commit failed. CAMEL-14935
* On partition-revoke, do the clearing of the offset inside a finally.
That way, it will happen even if the commit failed. CAMEL-14935
---
.../java/org/apache/camel/component/kafka/KafkaConsumer.java | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/components/camel-kafka/src/main/java/org/apache/camel/component/kafka/KafkaConsumer.java b/components/camel-kafka/src/main/java/org/apache/camel/component/kafka/KafkaConsumer.java
index 655ace1..d33d38f 100644
--- a/components/camel-kafka/src/main/java/org/apache/camel/component/kafka/KafkaConsumer.java
+++ b/components/camel-kafka/src/main/java/org/apache/camel/component/kafka/KafkaConsumer.java
@@ -431,8 +431,13 @@ public class KafkaConsumer extends DefaultConsumer {
offset = -1l;
}
log.debug("Saving offset repository state {} from offsetKey {} with offset: {}", threadId, offsetKey, offset);
- commitOffset(offsetRepository, partition, offset, true);
- lastProcessedOffset.remove(offsetKey);
+ try {
+ commitOffset(offsetRepository, partition, offset, true);
+ } catch (Exception e) {
+ log.error("Error saving offset repository state {} from offsetKey {} with offset: {}", threadId, offsetKey, offset);
+ } finally {
+ lastProcessedOffset.remove(offsetKey);
+ }
}
}