eolivelli commented on code in PR #20902:
URL: https://github.com/apache/pulsar/pull/20902#discussion_r1294835202


##########
pulsar-io/canal/src/main/java/org/apache/pulsar/io/canal/CanalSourceConfig.java:
##########
@@ -80,14 +83,31 @@ public class CanalSourceConfig implements Serializable{
         help = "The batch size to fetch from canal.")
     private int batchSize = 1000;
 
+
+    /**
+     * @deprecated Use {@link #load(String, SourceContext)} instead.
+     */
+    @Deprecated
     public static CanalSourceConfig load(String yamlFile) throws IOException {
         ObjectMapper mapper = new ObjectMapper(new YAMLFactory());
         return mapper.readValue(new File(yamlFile), CanalSourceConfig.class);
     }
 
+    public static CanalSourceConfig load(String yamlFile, SourceContext 
context) throws IOException {
+        ObjectMapper mapper = new ObjectMapper(new YAMLFactory());
+        return load(mapper.readValue(new File(yamlFile), new 
TypeReference<Map<String, Object>>() {}), context);
+    }
 
+    /**
+     * @deprecated Use {@link #load(Map, SourceContext)} instead.
+     */
+    @Deprecated
     public static CanalSourceConfig load(Map<String, Object> map) throws 
IOException {
         ObjectMapper mapper = new ObjectMapper();
         return mapper.readValue(mapper.writeValueAsString(map), 
CanalSourceConfig.class);
     }
+
+    public static CanalSourceConfig load(Map<String, Object> map, 
SourceContext context) {
+        return IOConfigUtils.loadWithSecrets(map, CanalSourceConfig.class, 
context);

Review Comment:
   What about adding a method in Context?
   Asking developers to use a Util class is a little API design smell to me



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to