process
method from the NodeJs function file, below is an example:
Avro
and Json
schema record, for Avro
scheme input and output:
Json
input and output:
Input | Java | Go(Pulsar) | Python | NodeJs |
---|---|---|---|---|
Custom SerDe | ✅ | ❌ | ✅ | ✅ |
Schema - Avro | ✅ | ❌ | ✅ | ✅ |
Schema - JSON | ✅ | ❌ | ✅ | ✅ |
Schema - Protobuf | ✅ | ❌ | ❌ | ❌ |
Schema - KeyValue | ✅ | ❌ | ❌ | ❌ |
Schema - AutoSchema | ✅ | ❌ | ❌ | ❌ |
Scehma - Protobuf Native | ✅ | ❌ | ❌ | ❌ |
e-2-e encryption | ✅ | ❌ | ✅ | ✅ |
maxMessageRetries | ✅ | ❌ | ❌ | ✅ |
dead-letter policy | ✅ | ❌ | ❌ | ✅ |
SubscriptionName | ✅ | ✅ | ✅ | ✅ |
SubscriptionType | ✅ | ✅ | ✅ | ✅ |
SubscriptionInitialPosition | ✅ | ❌ | ✅ | ✅ |
AutoAck | ✅ | ✅ | ✅ | ✅ |
Output | Java | Go(Pulsar) | Python | NodeJs |
---|---|---|---|---|
Custom SerDe | ✅ | ❌ | ✅ | ✅ |
Schema - Avro | ✅ | ❌ | ✅ | ✅ |
Schema - JSON | ✅ | ❌ | ✅ | ✅ |
Schema - Protobuf | ✅ | ❌ | ❌ | ❌ |
Schema - KeyValue | ✅ | ❌ | ❌ | ❌ |
Schema - AutoSchema | ✅ | ❌ | ❌ | ❌ |
Schema - Protobuf Native | ✅ | ❌ | ❌ | ❌ |
useThreadLocalProducers | ✅ | ❌ | ❌ | ✅ |
Key-based Batcher | ✅ | ✅ | ✅ | ✅ |
e-2-e encryption | ✅ | ❌ | ✅ | ✅ |
Compression | ✅ | ✅ | ✅ | ✅ |
Context | Java | Go(Pulsar) | Python | NodeJs |
---|---|---|---|---|
InputTopics | ✅ | ✅ | ✅ | ✅ |
OutputTopic | ✅ | ✅ | ✅ | ✅ |
CurrentRecord | ✅ | ✅ | ✅ | ✅ |
OutputSchemaType | ✅ | ❌ | ✅ | ✅ |
Tenant | ✅ | ✅ | ✅ | ✅ |
Namespace | ✅ | ✅ | ✅ | ✅ |
FunctionName | ✅ | ✅ | ✅ | ✅ |
FunctionId | ✅ | ✅ | ✅ | ✅ |
InstanceId | ✅ | ✅ | ✅ | ✅ |
NumInstances | ✅ | ❌ | ✅ | ✅ |
FunctionVersion | ✅ | ✅ | ✅ | ✅ |
PulsarAdminClient | ✅ | ❌ | ❌ | ❌ |
GetLogger | ✅ | ❌ | ✅ | ✅ |
RecordMetrics | ✅ | ✅ | ✅ | ❌ |
UserConfig | ✅ | ✅ | ✅ | ✅ |
Secrets | ✅ | ❌ | ✅ | ✅ |
State | ✅ | ❌ | ❌ | ✅ |
Publish | ✅ | ✅ | ✅ | ✅ |
ConsumerBuilder | ✅ | ❌ | ❌ | ❌ |
Seek / Pause / Resume | ✅ | ❌ | ❌ | ❌ |
PulsarClient | ✅ | ❌ | ❌ | ❌ |
Other | Java | Go(Pulsar) | Python | NodeJs |
---|---|---|---|---|
Resources | ✅ | ✅ | ✅ | ✅ |
At-most-once | ✅ | ✅ | ✅ | ✅ |
At-least-once | ✅ | ✅ | ✅ | ✅ |
Effectively-once | ✅ | ❌ | ✅ | ❌ |
.js
file or package your function into a .zip
file when creating NodeJs functions.
A zip file should contain:
pacakge.json
filepackage.json
:
package.json
:
package.json
and handle your function.
snctl
, pulsarctl
, pulsar-admin
command, the REST API, or terraform
to deploy a Pulsar function to your cluster.
You can create a NodeJs Pulsar function by using a local .js
or .zip
file or an uploaded Pulsar functions package(recommend).
--py
to specify the function file and specify the --custom-runtime-options '{"genericKind": "nodejs"}'
to make it work.