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()) {