Currently the following function signatures are supported when creating a Receiver:
|
// receiver creates a receiverFn wrapper class that is used by the client to |
|
// validate and invoke the provided function. |
|
// Valid fn signatures are: |
|
// * func() |
|
// * func() protocol.Result |
|
// * func(context.Context) |
|
// * func(context.Context) protocol.Result |
|
// * func(event.Event) |
|
// * func(event.Event) transport.Result |
|
// * func(context.Context, event.Event) |
|
// * func(context.Context, event.Event) protocol.Result |
|
// * func(event.Event) *event.Event |
|
// * func(event.Event) (*event.Event, protocol.Result) |
|
// * func(context.Context, event.Event) *event.Event |
|
// * func(context.Context, event.Event) (*event.Event, protocol.Result) |
I currently have a use-case where I need to return multiple cloudevents from a function. I think I have found a way to do this by creating a client like cloudevents.NewClientHTTP(cloudevents.WithTarget(knativeTarget)) inside the function and then sending the events.
It would have been nice if I could simply have had a function definition like func(context.Context, event.Event) ([]*event.Event, protocol.Result) or func(context.Context, event.Event) ([]event.Event, protocol.Result) that returns a slice of events, that would then have handled the events.
If this is something that would make sense, I could have a go and see I if I can implement this
Currently the following function signatures are supported when creating a Receiver:
sdk-go/v2/client/receiver.go
Lines 45 to 59 in 5aa0338
I currently have a use-case where I need to return multiple cloudevents from a function. I think I have found a way to do this by creating a client like
cloudevents.NewClientHTTP(cloudevents.WithTarget(knativeTarget))inside the function and then sending the events.It would have been nice if I could simply have had a function definition like
func(context.Context, event.Event) ([]*event.Event, protocol.Result)orfunc(context.Context, event.Event) ([]event.Event, protocol.Result)that returns a slice of events, that would then have handled the events.If this is something that would make sense, I could have a go and see I if I can implement this