From a9a73899f82977f99c0f51d74da750bfb34aff7d Mon Sep 17 00:00:00 2001 From: Bryan Keller Date: Sat, 20 Jan 2024 20:30:37 -0800 Subject: [PATCH] add comment --- .../apache/iceberg/connect/IcebergSinkConfig.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/kafka-connect/kafka-connect/src/main/java/org/apache/iceberg/connect/IcebergSinkConfig.java b/kafka-connect/kafka-connect/src/main/java/org/apache/iceberg/connect/IcebergSinkConfig.java index 636790ae9478..aa1ecdd5d1ba 100644 --- a/kafka-connect/kafka-connect/src/main/java/org/apache/iceberg/connect/IcebergSinkConfig.java +++ b/kafka-connect/kafka-connect/src/main/java/org/apache/iceberg/connect/IcebergSinkConfig.java @@ -429,6 +429,18 @@ public JsonConverter jsonConverter() { return jsonConverter; } + /** + * This method attempts to load the Kafka Connect worker properties, which are not exposed to + * connectors. It does this by parsing the Java command used to launch the worker, extracting the + * name of the properties file, and then loading the file.
+ * The sink uses these properties, if available, when initializing its internal Kafka clients. By + * doing this, Kafka-related properties only need to be set in the worker properties and do not + * need to be duplicated in the sink config.
+ * If the worker properties cannot be loaded, then Kafka-related properties must be set via the + * `iceberg.kafka.*` sink configs. + * + * @return The Kafka Connect worker properties + */ private Map loadWorkerProps() { String javaCmd = System.getProperty("sun.java.command"); if (javaCmd != null && !javaCmd.isEmpty()) {