You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2020/05/20 22:15:39 UTC

[GitHub] [pulsar] srkukarni commented on a change in pull request #6983: Added ability to add annotations to Connector Configs

srkukarni commented on a change in pull request #6983:
URL: https://github.com/apache/pulsar/pull/6983#discussion_r428338513



##########
File path: pulsar-functions/utils/src/main/java/org/apache/pulsar/functions/utils/SinkConfigUtils.java
##########
@@ -580,4 +595,24 @@ public static SinkConfig validateUpdate(SinkConfig existingConfig, SinkConfig ne
         }
         return mergedConfig;
     }
+
+    public static void validateConnectorConfig(SinkConfig sinkConfig, ClassLoader classLoader) {
+        try {
+            ConnectorDefinition defn = ConnectorUtils.getConnectorDefinition(classLoader);
+            if (defn.getSinkConfigClass() != null) {
+                Class configClass = Class.forName(defn.getSinkConfigClass(),  true, classLoader);
+                ObjectMapper mapper = new ObjectMapper();

Review comment:
       Changed

##########
File path: pulsar-functions/utils/src/main/java/org/apache/pulsar/functions/utils/SinkConfigUtils.java
##########
@@ -580,4 +595,24 @@ public static SinkConfig validateUpdate(SinkConfig existingConfig, SinkConfig ne
         }
         return mergedConfig;
     }
+
+    public static void validateConnectorConfig(SinkConfig sinkConfig, ClassLoader classLoader) {
+        try {
+            ConnectorDefinition defn = ConnectorUtils.getConnectorDefinition(classLoader);
+            if (defn.getSinkConfigClass() != null) {
+                Class configClass = Class.forName(defn.getSinkConfigClass(),  true, classLoader);
+                ObjectMapper mapper = new ObjectMapper();
+                Object configObject = mapper.readValue(new ObjectMapper().writeValueAsString(sinkConfig.getConfigs()), configClass);

Review comment:
       Changed




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org