Use built-in functions
Similar to built-in connectors, the code of Java functions packaged as NAR that are placed in the functions directory of the function worker are loaded at startup and can be referenced when creating a function.
For instance if you have a built-in function with name exclamation in its pulsar-io.yaml, you can create a function instance with:
bin/pulsar-admin functions create \
--function-type exclamation \
--inputs persistent://public/default/input-1 \
--output persistent://public/default/output-1
To get the list of available built-in Functions, use the available-functions command:
bin/pulsar-admin functions available-functions
If you add, replace, or delete a NAR file in a functions folder, reload the available built-in functions before using it.
bin/pulsar-admin functions reload
Reload is incremental: an archive with the same path and SHA-256 content checksum retains its existing cached package and classloader. New or changed archives are loaded, and replaced or removed cached packages are closed. Touching an unchanged file does not force a new classloader. Reload updates the worker's available-functions catalog; use the function update or restart operations to manage deployed instances separately. Distribute the intended archives to every relevant worker and verify available-functions after reloading.