You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by va...@apache.org on 2021/02/13 15:45:48 UTC

[camel-kafka-connector] branch master updated: Fix problem when call 'context.errantRecordReporter()' will result in a NoSuchMethodException or NoClassDefFoundError when the sink connector is deployed to Connect runtimes older than Kafka 2.6

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

valdar pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel-kafka-connector.git


The following commit(s) were added to refs/heads/master by this push:
     new c79f2a7  Fix problem when call 'context.errantRecordReporter()' will result in a NoSuchMethodException or NoClassDefFoundError when the sink connector is deployed to Connect runtimes older than Kafka 2.6
c79f2a7 is described below

commit c79f2a72e94c8bbaa33b5489bcbad500d4f666f4
Author: Eugene <ev...@moex.com>
AuthorDate: Fri Feb 12 19:46:27 2021 +0300

    Fix problem when call 'context.errantRecordReporter()' will result in a NoSuchMethodException or NoClassDefFoundError when the sink connector is deployed to Connect runtimes older than Kafka 2.6
---
 .../main/java/org/apache/camel/kafkaconnector/CamelSinkTask.java   | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/core/src/main/java/org/apache/camel/kafkaconnector/CamelSinkTask.java b/core/src/main/java/org/apache/camel/kafkaconnector/CamelSinkTask.java
index 50a44da..9352ed6 100644
--- a/core/src/main/java/org/apache/camel/kafkaconnector/CamelSinkTask.java
+++ b/core/src/main/java/org/apache/camel/kafkaconnector/CamelSinkTask.java
@@ -75,7 +75,12 @@ public class CamelSinkTask extends SinkTask {
             CamelSinkConnectorConfig config = getCamelSinkConnectorConfig(actualProps);
 
             if (context != null) {
-                reporter = context.errantRecordReporter();
+                try {
+                    reporter = context.errantRecordReporter();
+                } catch (NoSuchMethodError | NoClassDefFoundError e) {
+                    LOG.warn("Unable to instantiate ErrantRecordReporter.  Method 'SinkTaskContext.errantRecordReporter' does not exist.");
+                    reporter = null;
+                }
             }
 
             try {