Documentation ¶
Overview ¶
Package multichannelfanout provides an http.Handler that takes in one request to a Knative Channel and fans it out to N other requests. Logically, it represents multiple Knative Channels. It is made up of a map, map[channel]fanout.EventHandler and each incoming request is inspected to determine which Channel it is on. This Handler delegates the HTTP handling to the fanout.EventHandler corresponding to the incoming request's Channel. It is often used in conjunction with a swappable.Handler. The swappable.Handler delegates all its requests to the multichannelfanout.EventHandler. When a new configuration is available, a new multichannelfanout.EventHandler is created and swapped in for all subsequent requests. The old multichannelfanout.EventHandler is discarded.
Index ¶
- type ChannelConfig
- type Config
- type EventHandler
- func (h *EventHandler) CountChannelHandlers() int
- func (h *EventHandler) DeleteChannelHandler(host string)
- func (h *EventHandler) GetChannelHandler(host string) fanout.EventHandler
- func (h *EventHandler) ServeHTTP(response http.ResponseWriter, request *http.Request)
- func (h *EventHandler) SetChannelHandler(host string, handler fanout.EventHandler)
- type MultiChannelEventHandler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ChannelConfig ¶
type ChannelConfig struct { Namespace string Name string HostName string Path string FanoutConfig fanout.Config EventTypeHandler *eventtype.EventTypeAutoHandler ChannelAddressable *duckv1.KReference ChannelUID *types.UID }
ChannelConfig is the configuration for a single Channel.
type Config ¶
type Config struct {
ChannelConfigs []ChannelConfig
}
type EventHandler ¶ added in v0.39.0
type EventHandler struct {
// contains filtered or unexported fields
}
Handler is an http.Handler that introspects the incoming request to determine what Channel it is on, and then delegates handling of that request to the single fanout.FanoutEventHandler corresponding to that Channel.
func NewEventHandler ¶ added in v0.39.0
func NewEventHandler(_ context.Context, logger *zap.Logger) *EventHandler
NewHandler creates a new Handler.
func NewEventHandlerWithConfig ¶ added in v0.39.0
func NewEventHandlerWithConfig(_ context.Context, logger *zap.Logger, conf Config, reporter channel.StatsReporter, eventDispatcher *kncloudevents.Dispatcher, recvOptions ...channel.EventReceiverOptions) (*EventHandler, error)
NewEventHandlerWithConfig creates a new Handler with the specified configuration. This is really meant for tests where you want to apply a fully specified configuration for tests. Reconciler operates on single channel at a time.
func (*EventHandler) CountChannelHandlers ¶ added in v0.39.0
func (h *EventHandler) CountChannelHandlers() int
func (*EventHandler) DeleteChannelHandler ¶ added in v0.39.0
func (h *EventHandler) DeleteChannelHandler(host string)
func (*EventHandler) GetChannelHandler ¶ added in v0.39.0
func (h *EventHandler) GetChannelHandler(host string) fanout.EventHandler
func (*EventHandler) ServeHTTP ¶ added in v0.39.0
func (h *EventHandler) ServeHTTP(response http.ResponseWriter, request *http.Request)
ServeHTTP delegates the actual handling of the request to a fanout.EventHandler, based on the request's channel key.
func (*EventHandler) SetChannelHandler ¶ added in v0.39.0
func (h *EventHandler) SetChannelHandler(host string, handler fanout.EventHandler)
type MultiChannelEventHandler ¶ added in v0.39.0
type MultiChannelEventHandler interface { http.Handler SetChannelHandler(host string, handler fanout.EventHandler) DeleteChannelHandler(host string) GetChannelHandler(host string) fanout.EventHandler CountChannelHandlers() int }