Skip to main content
This section introduces how to develop and pacakge Golang Pulsar functions to use on StreamNative cloud. We provide a different Golang runtime other than the community one, and it’s still in private preview stage, If you want to try it out or have any questions, please submit a ticket to the support team.

Develop

We provide a GO SDK for developing Golang Pulsar Functions. The following examples use Pulsar Functions SDK for the Golang language.
To get more examples, please refer to examples

Feature Matrix

The StreamNative’s Golang runtime doesn’t support full features comparing to Java runtime, and it’s still in developing, below is the matrix:

Input Arguments

Users can implement the Schema themselves since we are passing and expecting []byte to/from the users’ function, so leave ? here.

Output Arguments

Context

Other

Package

For Golang, we need to compile the function file to an executable one:
  1. Prepare your function file:
  2. Compile

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 Golang Pulsar function by using a local compiled Golang file or an uploaded Pulsar functions package(recommend).

(Optional) Upload your function file to Pulsar

It’s recommended to upload your function file to Pulsar before you create a function. Since you can add a version suffix to the package.
Upload packages
You should see the following output:

Create

We are using a different Golang runtime, need to specify the --custom-runtime-options '{"genericKind": "executable"}' to make it work.
You should see something like this:
For details about Pulsar function configurations, see Pulsar function configurations.

What’s next?