Function Signatures
Comparison of different function signatures
There’re three function signatures in OpenFunction: HTTP Functions
, CloudEvent Functions
, and OpenFunction Functions
. Let’s explain this in more detail using Go function signature as an example.
HTTP Functions
and CloudEvent Functions
can be used to create sync functions while OpenFunction Functions
can be used to create both sync and async functions.
Further more OpenFunction Functions
can utilize various Dapr building blocks including Bindings, Pub/sub etc. to create more powerful functions. (Dapr State management, Configuration will be supported soon)
HTTP Functions | CloudEvent Functions | OpenFunction Functions | |
---|---|---|---|
Signature | func(http.ResponseWriter, *http.Request) error | func(context.Context, cloudevents.Event) error | func(ofctx.Context, []byte) (ofctx.Out, error) |
Sync Functions | Supported | Supported | Supported |
Async Functions | Not supported | Not supported | Supported |
Dapr Binding | Not supported | Not supported | Supported |
Dapr Pub/sub | Not supported | Not supported | Supported |
Samples
As you can see, OpenFunction Functions
is the recommended function signature, and we’re working on supporting this function signature in more language runtimes.
HTTP Functions | CloudEvent Functions | OpenFunction Functions | |
---|---|---|---|
Go | Hello World, Multi-functions, log processing | Sync function with output binding, Kafka input & HTTP output binding, Cron input & Kafka output binding, Cron input binding, Kafka input binding, Kafka pubsub | |
Nodejs | Hello World | Sync function with output binding, MQTT binding & pubsub | |
Python | Hello World | ||
Java | Hello World | ||
DotNet | Hello World |
Last modified June 19, 2022: Adjust Capital (#111) (fd2e4cc)