How can I create an instance of builtin Pulsar Function using the Pulsar REST API? #22266
-
I am trying to create an instance of a builtin Pulsar Function using the Pulsar REST API. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
when using a builtin function, it's necessary to pass Something like this (example using cat >/tmp/functionconfig.json <<EOF
{
"tenant": "public",
"namespace": "default",
"name": "myfunction",
"jar": "builtin://builtin-function-name",
"runtime": "JAVA",
"inputs": [
"public/default/input-topic"
],
"output": "public/default/output-topic",
"autoAck": true,
"parallelism": 1
}
EOF
curl -H "Authorization: Bearer $(cat token)" -v -X POST \
-F "functionConfig=@/tmp/functionconfig.json;type=application/json" \
http://pulsar-function-worker:6750/admin/v3/functions/public/default/myfunction It's not related to this question, but to expand the curl example to cover uploading of a jar/nar file, this is the way curl can be used to create functions from a jar/nar file: cat >/tmp/functionconfig.json <<EOF
{
"tenant": "public",
"namespace": "default",
"name": "myfunction",
"className": "MyFunction",
"runtime": "JAVA",
"inputs": [
"public/default/input-topic"
],
"output": "public/default/output-topic",
"autoAck": true,
"parallelism": 1
}
EOF
curl -H "Authorization: Bearer $(cat token)" -v -X POST \
-F "functionConfig=@/tmp/functionconfig.json;type=application/json" \
-F "[email protected];type=application/octet-stream" \
http://pulsar-function-worker:6750/admin/v3/functions/public/default/myfunction |
Beta Was this translation helpful? Give feedback.
when using a builtin function, it's necessary to pass
builtin://<function name>
in thejar
key of function config.Something like this (example using
curl
):It's not rela…