Open benjaminhuo opened 2 years ago
When I play around with the ff-go, I come up with the following enhancements (apply to all ff), which I think will be good to improve the functionality and user experience.
'/user/<username>'
and get it by vars := mux.Vars(r)
, or define the allowing HTTP methods when registering the function like r.Methods("GET", "POST")
metadata
field in send
function which is widely used in pubsub and binding (for example s3 binding)DaprClient
and use it in the function.
send
function, however, dapr has many other building blocks which are yet to support.takes time
. Opening up the DaprClient for exploration will be a better option now for users who have the experience to explore their use cases.multiple functions
. However, the plugin is defined at the framework level and applies to all the functions. WithPrePlugins([]string{”plugin-1”, “plugin-2”})
when registering the function.pathPrefix
rather than pattern
field in the runtime here as we define the path at the function level now.event
data in ofn function type (fn(ctx ofctx.Context, in []byte)
) when the incoming request is a cloudevent.[]byte
) to the user function. However, in the cloudevent spec, there are fields like type
, source
, id
, time
and other custom attributes
, which user may use them in the user function.ctx
.Feel free to provide your feedback.
- support
metadata
field insend
function which is widely used in pubsub and binding (for example s3 binding)
In this PR I tried to introduce some options for the Send()
and we can also pass some metadatas in this way. We can discuss how to pass metadata in the PR.
support plugin selection at the function level
- as we are able to support
multiple functions
. However, the plugin is defined at the framework level and applies to all the functions.- provide options like
WithPrePlugins([]string{”plugin-1”, “plugin-2”})
when registering the function.
function-level
plugin configuration is now supported, pls see this. Does this meet with your needs?
support get the raw
event
data in ofn function type (fn(ctx ofctx.Context, in []byte)
) when the incoming request is a cloudevent.
- current in the ofn function type, ofn helps to decode the cloudevent internally and pass the data field (
[]byte
) to the user function. However, in the cloudevent spec, there are fields liketype
,source
,id
,time
and other customattributes
, which user may use them in the user function.- Possible solution is that the user can get the raw cloudevent data from the
ctx
.
Currently supports getting the raw event from the Context, pls see this. And it can be used like this.
- support
metadata
field insend
function which is widely used in pubsub and binding (for example s3 binding)In this PR I tried to introduce some options for the
Send()
and we can also pass some metadatas in this way. We can discuss how to pass metadata in the PR.
support plugin selection at the function level
- as we are able to support
multiple functions
. However, the plugin is defined at the framework level and applies to all the functions.- provide options like
WithPrePlugins([]string{”plugin-1”, “plugin-2”})
when registering the function.
function-level
plugin configuration is now supported, pls see this. Does this meet with your needs?
support get the raw
event
data in ofn function type (fn(ctx ofctx.Context, in []byte)
) when the incoming request is a cloudevent.
- current in the ofn function type, ofn helps to decode the cloudevent internally and pass the data field (
[]byte
) to the user function. However, in the cloudevent spec, there are fields liketype
,source
,id
,time
and other customattributes
, which user may use them in the user function.- Possible solution is that the user can get the raw cloudevent data from the
ctx
.Currently supports getting the raw event from the Context, pls see this. And it can be used like this.
cool, I have removed it from the list.
cool, I have removed it from the list.
It reflects that we lack a feature document or feature summary...🥲
Need to add the following method to context:
Currently, we use send for both pubsub and binding, which is not accurate
Adjustments that need to be made:
dapr-proxy
mode, functions-framework need to get DAPR_HOST
from env vars, init daprClient based on DAPR_HOST
and DAPR_HTTP_PORT
/DAPR_GRPC_PORT
.
OpenFunction already have implemented the functions-framework-go and functions-framework-nodejs, the functions-framework-python, functions-framework-dotnet and functions-framework-java is also under developing.
We need a spec to guide the development of each language's functions framework.
Here is a draft of such a Spec https://hackmd.io/@xcEqMy2IQx-DQu_nUuPNXw/HkXqDW6P5 We need to create an English version of this and add more content to it based on each language's functions framework's experiences.
The author of each language's functions framework should contribute to this doc
@tpiperatgod @webup @wanjunlei @kehuili @geffzhang