Documentation ¶
Index ¶
- Constants
- func HandleDiscardEventsIDValue() string
- func HandlerWrapperModule() fx.Option
- func HelperModule(extraOptions fx.Option) fx.Option
- type Handler
- type HandlerWrapper
- type HandlerWrapperOptions
- type Helper
- type InOut
- type Middleware
- type UnimplementedMiddleware
- func (u UnimplementedMiddleware) After(ctx context.Context, in v2.Event, out *v2.Event, err error) (context.Context, error)
- func (u UnimplementedMiddleware) AfterAll(ctx context.Context, inout []*InOut) (context.Context, error)
- func (u UnimplementedMiddleware) Before(ctx context.Context, in *v2.Event) (context.Context, error)
- func (u UnimplementedMiddleware) BeforeAll(ctx context.Context, inout []*InOut) (context.Context, error)
- func (u UnimplementedMiddleware) Close(ctx context.Context) error
Constants ¶
const (
PluginsRoot = root + ".plugins"
)
Variables ¶
This section is empty.
Functions ¶
func HandleDiscardEventsIDValue ¶
func HandleDiscardEventsIDValue() string
HandleDiscardEventsIDValue returns the event IDs to be discarded comma-separated from the configuration via "faas.cloudevents.handle.discard.ids" key.
func HandlerWrapperModule ¶
HandlerWrapperModule returns fx module for initialization of event handler wrapped in middleware.
The module is only loaded once.
Types ¶
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler can be used to process events.
func NewHandler ¶
func NewHandler(h *HandlerWrapper) *Handler
NewHandler creates a new handler wrapped in middleware.
type HandlerWrapper ¶
type HandlerWrapper struct {
// contains filtered or unexported fields
}
HandlerWrapper can be used to process events wrapped in middleware.
func NewDefaultHandlerWrapper ¶
func NewDefaultHandlerWrapper(handler cloudevents.Handler, middlewares ...Middleware) *HandlerWrapper
NewDefaultHandlerWrapper creates a new handler wrapped in middleware.
func NewHandlerWrapper ¶
func NewHandlerWrapper(handler cloudevents.Handler, options *HandlerWrapperOptions, middlewares ...Middleware) *HandlerWrapper
NewHandlerWrapper creates a new handler with options and wrapped in middleware.
type HandlerWrapperOptions ¶
type HandlerWrapperOptions struct {
IDsToDiscard []string
}
HandlerWrapperOptions represents options for handler wrapped in middleware.
func DefaultHandlerWrapperOptions ¶
func DefaultHandlerWrapperOptions() (*HandlerWrapperOptions, error)
DefaultHandlerWrapperOptions returns handler wrapped in middleware options.
type Helper ¶
type Helper struct {
// contains filtered or unexported fields
}
Helper assists in creating event handlers.
type Middleware ¶
type Middleware interface { BeforeAll(ctx context.Context, inout []*InOut) (context.Context, error) Before(ctx context.Context, in *v2.Event) (context.Context, error) After(ctx context.Context, in v2.Event, out *v2.Event, err error) (context.Context, error) AfterAll(ctx context.Context, inout []*InOut) (context.Context, error) Close(ctx context.Context) error }
Middleware defines an interface to process middleware.
func NewUnimplementedMiddleware ¶
func NewUnimplementedMiddleware() Middleware
NewUnimplementedMiddleware returns a default middleware implementation.
type UnimplementedMiddleware ¶
type UnimplementedMiddleware struct { }
UnimplementedMiddleware defines default implementation for middleware.
func (UnimplementedMiddleware) After ¶
func (u UnimplementedMiddleware) After(ctx context.Context, in v2.Event, out *v2.Event, err error) (context.Context, error)
After is called after each handler, but this implementation does nothing.
func (UnimplementedMiddleware) AfterAll ¶
func (u UnimplementedMiddleware) AfterAll(ctx context.Context, inout []*InOut) (context.Context, error)
AfterAll is called after all handlers, but this implementation does nothing.
func (UnimplementedMiddleware) Before ¶
Before is called before each handler, but this implementation does nothing.