Skip to content

Support returning slice/array of cloudevents from Receiver #1247

@AlfredBerg

Description

@AlfredBerg

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions