Otavio Rodolfo Piske created CAMEL-16973:
--------------------------------------------

             Summary: camel-kafka: messages may be lost on stop or shutdown
                 Key: CAMEL-16973
                 URL: https://issues.apache.org/jira/browse/CAMEL-16973
             Project: Camel
          Issue Type: Bug
          Components: camel-kafka
            Reporter: Otavio Rodolfo Piske
            Assignee: Otavio Rodolfo Piske


The fetch record class calls Kafka's Client wakeup method [1]. By calling this 
method, it causes blocking code to throw the WakeUpException if they are 
blocked or on the next call that would block. Ideally, this exception should be 
handled cleanly, as it indicates a preemptive reaction to a call that would 
block [2] and not the usual case of an error condition.

 

There are some circumstances that may cause the code to lost messages. For 
example:

1. If the code is using Manual commit and the shutdown is called while the 
exchange is being processed [3], this would cause the WakeUpException to be 
handled as normal exception [4].

2. It could also happen in similar circumstances the commit section of the code 
later on.

 

As such, if the stop or shutdown procedure is started while the code is in

 

1. 
[https://github.com/apache/camel/blob/main/components/camel-kafka/src/main/java/org/apache/camel/component/kafka/KafkaFetchRecords.java#L478-L488
]
2. 
[https://kafka.apache.org/21/javadoc/?org/apache/kafka/common/errors/WakeupException.html]

3. 
[https://github.com/apache/camel/blob/main/components/camel-kafka/src/main/java/org/apache/camel/component/kafka/KafkaFetchRecords.java#L275-L279]
   

4. 
[https://github.com/apache/camel/blob/main/components/camel-kafka/src/main/java/org/apache/camel/component/kafka/KafkaFetchRecords.java#L350]



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to