This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/master by this push:
     new 8194f00  CAMEL-16413: camel-kafka - KafkaConsumer should not during 
stopping/shutdown force commit offset if partiotion is revoked event is 
triggered, but commit accordingly to autoCommitOnStop configuration.
8194f00 is described below

commit 8194f00f7e49b728e73c9d152b9a0972f0349e12
Author: Claus Ibsen <claus.ib...@gmail.com>
AuthorDate: Wed Mar 31 14:58:46 2021 +0200

    CAMEL-16413: camel-kafka - KafkaConsumer should not during 
stopping/shutdown force commit offset if partiotion is revoked event is 
triggered, but commit accordingly to autoCommitOnStop configuration.
---
 .../src/main/java/org/apache/camel/component/kafka/KafkaConsumer.java | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

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 0ccd056..f25fee0 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
@@ -601,7 +601,9 @@ public class KafkaConsumer extends DefaultConsumer {
         public void onPartitionsRevoked(Collection<TopicPartition> partitions) 
{
             LOG.debug("onPartitionsRevoked: {} from topic {}", threadId, 
topicName);
 
-            boolean stopping = isStoppingOrStopped();
+            // if camel is stopping or we are stopping then the commit offset 
needs to be handled specially
+            boolean stopping = getEndpoint().getCamelContext().isStopping() || 
isStoppingOrStopped();
+
             StateRepository<String, String> offsetRepository = 
endpoint.getConfiguration().getOffsetRepository();
             for (TopicPartition partition : partitions) {
                 String offsetKey = serializeOffsetKey(partition);

Reply via email to