From 6dd796dca5d8fb6e1a2f28f8abb9c9072a718775 Mon Sep 17 00:00:00 2001 From: laminar Date: Wed, 26 Apr 2023 09:26:20 +0800 Subject: [PATCH] new docs for "Support for launching Pulsar Functions using configuration files" Signed-off-by: laminar --- docs/functions-runtime-process.md | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/docs/functions-runtime-process.md b/docs/functions-runtime-process.md index aa2367840f62..c8e171f82e0f 100644 --- a/docs/functions-runtime-process.md +++ b/docs/functions-runtime-process.md @@ -22,3 +22,33 @@ functionRuntimeFactoryConfigs: ``` For more details, see [code](https://github.com/apache/pulsar/blob/master/pulsar-functions/runtime/src/main/java/org/apache/pulsar/functions/runtime/process/ProcessRuntimeFactoryConfig.java). + +Pulsar Functions now supports setting runtime parameters using a configuration file. Currently, only the Python Runtime is supported. The path to the configuration file can be specified with the `--config-file` parameter. + +The configuration file should be written in `.ini` format, with each parameter being configured as `key = value`. Here's an example: + +```ini +[DEFAULT] +logging_level = info +max_pending_async_requests = 1000 +max_concurrent_requests = 50 +``` + +Note that parameters in the configuration file will override those of the same name specified on the command line. + +Let's assume we have a configuration file named `config.ini` with the above contents. Then we can start the Python Runtime using the configuration file with the following command: + +```shell +pulsar-admin functions localrun \ + --py /path/to/python_instance.py \ + --config-file /path/to/config.ini \ + --classname MyFunction \ + --logging_leve debug \ + --inputs persistent://public/default/my-input-topic \ + --output persistent://public/default/my-output-topic \ + --log-topic persistent://public/default/functions-logs +``` + +This starts the Python Runtime with the parameters specified in the configuration file. + +Note that when starting with a configuration file, all parameters can be set in the configuration file. If you specify parameters on the command line that are also present in the configuration file, the values of the parameters on the command line will take precedence over the values in the configuration file (In the example above, the `logging_level` will be set to `debug`).