1. Process Data Streams
  2. Generic Runtime(Alpha)

Develop&Deploy Executable Function

For compiled languages like Golang, you need to compile your function to an Executable file first, then upload it to StreamNative Cloud.

To do that, besides the "process" method, you also need to implement an "entrypoint" to wrap your function.

Below is the pseudocode of the entrypoint:

loop:
    read input from stdin # input is a byte array
    unmashal input to your data structure
    call process(input)
    marshal output to bytes
    write output to stdout

We provide a template for golang, you just need to update the process method in process.go and run go build -a -o exclamation *.go to compile your function to an executable file.

If you want to use other compiled languages like Rust/C/C++, you can refer to this Golang template to implement your own entrypoint.

Upload your function file to Pulsar

Please refer to: Upload Function Package

Create an Executable kind generic runtime Pulsar function

pulsarctl functions create \
--tenant public \
--namespace default \
--name function1 \
--inputs persistent://public/default/test-executable-input \
--output persistent://public/default/test-executable-output \
--classname exclamation \
--py function://public/default/[email protected]
--custom-runtime-options '{"genericKind": "executable"}'

You should see something like this:

Created function1 successfully

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

What’s next?

Previous
Develop&Deploy Python Function