You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by "oneebhkhan (via GitHub)" <gi...@apache.org> on 2024/03/14 10:47:41 UTC
[D] How can I create an instance of builtin Pulsar Function using the Pulsar REST API? [pulsar]
GitHub user oneebhkhan created a discussion: How can I create an instance of builtin Pulsar Function using the Pulsar REST API?
I am trying to create an instance of a builtin Pulsar Function using the Pulsar REST API.
However, I am coming across an issue where I get the following error:
`400: {"reason":"Function package is not provided"}`
I am using a multi-part upload for the REST request and the entire point of using a builtin function is so that I can avoid having to specify the function package.
GitHub link: https://github.com/apache/pulsar/discussions/22266
----
This is an automatically sent email for commits@pulsar.apache.org.
To unsubscribe, please send an email to: commits-unsubscribe@pulsar.apache.org
Re: [D] How can I create an instance of builtin Pulsar Function using the Pulsar REST API? [pulsar]
Posted by "lhotari (via GitHub)" <gi...@apache.org>.
GitHub user lhotari added a comment to the discussion: How can I create an instance of builtin Pulsar Function using the Pulsar REST API?
when using a builtin function, it's necessary to pass `builtin://<function name>` in the `jar` key of function config.
Something like this (example using `curl`):
```shell
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:
```shell
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 -k -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
```
GitHub link: https://github.com/apache/pulsar/discussions/22266#discussioncomment-8784659
----
This is an automatically sent email for commits@pulsar.apache.org.
To unsubscribe, please send an email to: commits-unsubscribe@pulsar.apache.org
Re: [D] How can I create an instance of builtin Pulsar Function using the Pulsar REST API? [pulsar]
Posted by "lhotari (via GitHub)" <gi...@apache.org>.
GitHub user lhotari edited a comment on the discussion: How can I create an instance of builtin Pulsar Function using the Pulsar REST API?
when using a builtin function, it's necessary to pass `builtin://<function name>` in the `jar` key of function config.
Something like this (example using `curl`):
```shell
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:
```shell
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
```
GitHub link: https://github.com/apache/pulsar/discussions/22266#discussioncomment-8784659
----
This is an automatically sent email for commits@pulsar.apache.org.
To unsubscribe, please send an email to: commits-unsubscribe@pulsar.apache.org