Package Go Functions
Currently, Go functions can be implemented only using SDK and the interface of functions is exposed in the form of SDK. Before using Go functions, you need to import github.com/apache/pulsar/pulsar-function-go/pf
.
To package a Go function, complete the following steps.
-
Prepare a Go function file.
-
Build the Go function.
go build <your Go function filename>.go
-
Run the Go function with the following command.
bin/pulsar-admin functions localrun \
--go [absolute path to your go function]
--inputs [input topics] \
--output [output topic] \
--tenant [default:public] \
--namespace [default:default] \
--name [custom unique go function name]The following log indicates that the Go function starts successfully.
...
07:55:03.724 [main] INFO org.apache.pulsar.functions.runtime.ProcessRuntime - Started process successfully
...