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

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


The following commit(s) were added to refs/heads/main by this push:
     new e89f820c82b CAMEL-17925: Process exception in exchange and not only in 
catch. (#7906)
e89f820c82b is described below

commit e89f820c82b71ee9325c91a2a9ad631e8c2759ec
Author: klease <38634989+kle...@users.noreply.github.com>
AuthorDate: Mon Jun 27 20:23:57 2022 +0200

    CAMEL-17925: Process exception in exchange and not only in catch. (#7906)
---
 .../component/kafka/consumer/support/KafkaRecordProcessor.java    | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git 
a/components/camel-kafka/src/main/java/org/apache/camel/component/kafka/consumer/support/KafkaRecordProcessor.java
 
b/components/camel-kafka/src/main/java/org/apache/camel/component/kafka/consumer/support/KafkaRecordProcessor.java
index 8e446d194b3..38763385b78 100644
--- 
a/components/camel-kafka/src/main/java/org/apache/camel/component/kafka/consumer/support/KafkaRecordProcessor.java
+++ 
b/components/camel-kafka/src/main/java/org/apache/camel/component/kafka/consumer/support/KafkaRecordProcessor.java
@@ -109,14 +109,14 @@ public class KafkaRecordProcessor {
             processor.process(exchange);
         } catch (Exception e) {
             exchange.setException(e);
-
+        }
+        if (exchange.getException() != null) {
             boolean breakOnErrorExit = processException(exchange, partition, 
lastResult.getPartitionLastOffset(),
                     exceptionHandler);
-
             return new ProcessingResult(breakOnErrorExit, 
lastResult.getPartitionLastOffset(), true);
+        } else {
+            return new ProcessingResult(false, record.offset(), 
exchange.getException() != null);
         }
-
-        return new ProcessingResult(false, record.offset(), 
exchange.getException() != null);
     }
 
     private boolean processException(

Reply via email to