1. Drop the plugin.
  2. Restart eKuiper.
  3. Create the plugin with the new configuration.

The API accepts a JSON content to create a new plugin. Each plugin type has a standalone endpoint. The supported types are . The plugin is identified by the name. The name must be unique.

Request Sample when the file locates in a http server

  1. {
  2. "name":"random",
  3. "file":"http://127.0.0.1/plugins/sources/random.zip"
  4. }

Request Sample for files locates in the same machine of the Kuiepr server.

  1. {
  2. "name":"random",
  3. "file":"file:///var/plugins/sources/random.zip"
  4. }
  1. name: a unique name of the plugin. The name must be the same as the camel case version of the plugin with lowercase first letter. For example, if the exported plugin name is Random, then the name of this plugin is random.
  2. file: the url of the plugin files. The url can be http or https scheme or file scheme to refer to a local file path of the eKuiper server. It must be a zip file with: a compiled so file and the yaml file(only required for sources). If the plugin depends on some external dependencies, a bash script named install.sh can be provided to do the dependency installation. The name of the files must match the name of the plugin. Please check for the naming rule.

Note: For portables type, please refer to this format.

A sample zip file for a source named random.zip

  1. Random@v1.0.0.so
  2. random.yaml
  3. install.sh
  4. Various dependency files/folders of install.sh
    • mysdk.zip
    • myconfig.conf

Notice that, the install.sh will be run that the system may already had the lib or package. Make sure to check the path before. Below is an example install.sh to install a sample sdk lib.

  1. #!/bin/sh
  2. dir=/usr/local/mysdk
  3. cur=$(dirname "$0")
  4. echo "Base path $cur"
  5. if [ -d "$dir" ]; then
  6. echo "SDK path $dir exists."
  7. else
  8. echo "Creating SDK path $dir"
  9. mkdir -p $dir
  10. echo "Created SDK path $dir"
  11. fi
  12. apt install --no-upgrade unzip
  13. if [ -d "$dir/lib" ]; then
  14. echo "SDK lib path $dir/lib exists."
  15. else
  16. echo "Unzip SDK lib to path $dir"
  17. unzip $cur/mysdk.zip -d $dir
  18. echo "Unzipped SDK lib to path $dir"
  19. fi
  20. if [ -f "/etc/ld.so.conf.d/myconfig.conf" ]; then
  21. echo "/etc/ld.so.conf.d/myconfig.conf exists"
  22. else
  23. echo "Copy conf file"
  24. cp $cur/myconfig.conf /etc/ld.so.conf.d/
  25. echo "Copied conf file"
  26. fi
  27. ldconfig

show plugins

  1. GET http://localhost:9081/plugins/sources
  2. GET http://localhost:9081/plugins/sinks
  3. GET http://localhost:9081/plugins/functions
  4. GET http://localhost:9081/plugins/portables

Response Sample:

The API is used to print out the detailed definition of a plugin.

  1. GET http://localhost:9081/plugins/sources/{name}
  2. GET http://localhost:9081/plugins/sinks/{name}
  3. GET http://localhost:9081/plugins/functions/{name}
  4. GET http://localhost:9081/plugins/portables/{name}

Path parameter is the name of the plugin.

Response Sample:

  1. {
  2. "name": "plugin1",
  3. "version": "1.0.0"
  4. }

drop a plugin

The API is used for drop the plugin. The eKuiper server needs to be restarted to take effect.

  1. DELETE http://localhost:9081/plugins/sources/{name}
  2. DELETE http://localhost:9081/plugins/sinks/{name}
  3. DELETE http://localhost:9081/plugins/functions/{name}
  4. DELETE http://localhost:9081/plugins/portables/{name}

The user can pass a query parameter to decide if eKuiper should be stopped after a delete in order to make the deletion take effect. The parameter is stop and only when the value is 1 will the eKuiper be stopped. The user has to manually restart it.

  1. DELETE http://localhost:9081/plugins/sources/{name}?stop=1

The API is used for displaying all user defined functions which are defined across all plugins.

Response Sample:

  1. ["func1","func2"]

The API is used to find out the plugin which defines the UDF.

  1. GET http://localhost:9081/plugins/udfs/{name}

Response Sample:

  1. {
  2. "name": "funcName",
  3. "plugin": "pluginName"
  4. }

The API aims to register all exported functions in an auto loaded function plugin or when the exported functions are changed. If the plugin was loaded by CLI create command or REST create API with functions property specified, then this is not needed. The register API will persist the functions list in the kv. Unless the exported functions are changed, users only need to register it once.

  1. POST http://{{host}}/plugins/functions/{plugin_name}/register
  2. {"functions":["func1","func2"]}

Get the available plugins

According to the configuration pluginHosts in file etc/kuiper.yaml , it returns the plugins list that can be installed at local run eKuiper instance. By default, it get the list from https://packages.emqx.net .

  1. {
  2. "file": "http://127.0.0.1:63767/kuiper-plugins/0.9.1/sinks/alpine/file_arm64.zip",
  3. "influx": "http://127.0.0.1:63767/kuiper-plugins/0.9.1/sinks/alpine/influx_arm64.zip",
  4. }