How can I create an instance of builtin Pulsar Function using the Pulsar REST API? #22266
Answered
by
lhotari
oneebhkhan
asked this question in
Q&A
|
I am trying to create an instance of a builtin Pulsar Function using the Pulsar REST API. |
Answered by
lhotari
Mar 14, 2024
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/myfunctionIt'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 "data=@function.jar;type=application/octet-stream" \
http://pulsar-function-worker:6750/admin/v3/functions/public/default/myfunction |
0 replies
Answer selected by
oneebhkhan
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
when using a builtin function, it's necessary to pass
builtin://<function name>in thejarkey of function config.Something like this (example using
curl):It's not rela…