merlimat closed pull request #2486: Added the --custom-schema-inputs cli arg to allow custom schema input to functions URL: https://github.com/apache/incubator-pulsar/pull/2486
This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): diff --git a/pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdFunctions.java b/pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdFunctions.java index 18d483c563..1ba7751cfa 100644 --- a/pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdFunctions.java +++ b/pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdFunctions.java @@ -256,6 +256,8 @@ void processArguments() throws Exception { protected String DEPRECATED_customSerdeInputString; @Parameter(names = "--custom-serde-inputs", description = "The map of input topics to SerDe class names (as a JSON string)") protected String customSerdeInputString; + @Parameter(names = "--custom-schema-inputs", description = "The map of input topics to Schema class names (as a JSON string)") + protected String customSchemaInputString; // for backwards compatibility purposes @Parameter(names = "--outputSerdeClassName", description = "The SerDe class to be used for messages output by the function", hidden = true) protected String DEPRECATED_outputSerdeClassName; @@ -377,6 +379,11 @@ void processArguments() throws Exception { Map<String, String> customSerdeInputMap = new Gson().fromJson(customSerdeInputString, type); functionConfig.setCustomSerdeInputs(customSerdeInputMap); } + if (null != customSchemaInputString) { + Type type = new TypeToken<Map<String, String>>(){}.getType(); + Map<String, String> customschemaInputMap = new Gson().fromJson(customSchemaInputString, type); + functionConfig.setCustomSchemaInputs(customschemaInputMap); + } if (null != topicsPattern) { functionConfig.setTopicsPattern(topicsPattern); } diff --git a/site2/docs/reference-pulsar-admin.md b/site2/docs/reference-pulsar-admin.md index 459afce4da..53d33b1629 100644 --- a/site2/docs/reference-pulsar-admin.md +++ b/site2/docs/reference-pulsar-admin.md @@ -310,6 +310,7 @@ Options |`--broker-service-url `|The URL of the Pulsar broker|| |`--classname`|The name of the function’s class|| |`--custom-serde-inputs`|A map of the input topic to SerDe name|| +|`--custom-schema-inputs`|A map of the input topic to Schema class name|| |`--client-auth-params`|Client Authentication Params|| |`--function-config-file`|The path of the YAML config file used to configure the function|| |`--hostname-verification-enabled`|Enable Hostname verification|| @@ -354,6 +355,7 @@ Options |`--auto-ack`|Let the functions framework manage acking|| |`--classname`|The name of the function’s class|| |`--custom-serde-inputs`|A map of the input topic to SerDe name|| +|`--custom-schema-inputs`|A map of the input topic to Schema class name|| |`--function-config-file`|The path of the YAML config file used to configure the function|| |`--inputs`|The input topics for the function (as a comma-separated list if more than one topic is desired)|| |`--log-topic`|The topic to which logs from this function are published|| @@ -411,6 +413,7 @@ Options |`--auto-ack`|Let the functions framework manage acking|| |`--classname`|The name of the function’s class|| |`--custom-serde-inputs`|A map of the input topic to SerDe name|| +|`--custom-schema-inputs`|A map of the input topic to Schema class name|| |`--function-config-file`|The path of the YAML config file used to configure the function|| |`--inputs`|The input topics for the function (as a comma-separated list if more than one topic is desired)|| |`--log-topic`|The topic to which logs from this function are published|| ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services