This section introduces how to develop and pacakge Python Pulsar functions to use on StreamNative cloud.

Develop

StreamNative supports all features for the Python functions, please refer to: Develop Functions to learn how to develop a Python Function.

Package

Please refer to: Pacakge Python Functions

Deploy

After creating a cluster, set up your environment and develop&package your function, you can use the snctl, pulsarctl, pulsar-admin command, the REST API, or terraform to deploy a Pulsar function to your cluster.

You can create a Python Pulsar function by using a local .py, .pip, or .zip file or an uploaded Pulsar functions package(recommend).

(Optional) Upload your function file to Pulsar

It’s recommend to upload your function file to Pulsar before you create a function. Since you can add a version suffix to the package.

Upload packages

snctl pulsar admin packages upload function://public/default/exclamation@v0.1 \
--path exclamation-1.0-SNAPSHOT.jar \
--description "exclamation function" \
--properties fileName=exclamation-1.0-SNAPSHOT.jar

You should see the following output:

The package 'function://public/default/exclamation@v0.1' uploaded from path 'examples/api-examples.jar' successfully

Create

snctl pulsar admin functions create \
--tenant public \
--namespace default \
--name function1 \
--inputs persistent://public/default/test-python-input \
--output persistent://public/default/test-python-output \
--classname exclamation.ExclamationFunction \
--py function://public/default/py-exclamation@v0.1
--use-service-account

You should see something like this:

Created function1 successfully

For details about Pulsar function configurations, see Pulsar function configurations.

What’s next?