Version: v0.28.0 Latest Latest

This package is not in the latest version of its module.

Go to latest
Published: Dec 13, 2021 License: Apache-2.0 Imports: 7 Imported by: 25



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.MessageHandler and each incoming request is inspected to determine which Channel it is on. This Handler delegates the HTTP handling to the fanout.MessageHandler 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.MessageHandler. When a new configuration is available, a new multichannelfanout.MessageHandler is created and swapped in for all subsequent requests. The old multichannelfanout.MessageHandler is discarded.



This section is empty.


This section is empty.


This section is empty.


type ChannelConfig

type ChannelConfig struct {
	Namespace    string
	Name         string
	HostName     string
	FanoutConfig fanout.Config

ChannelConfig is the configuration for a single Channel.

type Config

type Config struct {
	ChannelConfigs []ChannelConfig

type MessageHandler added in v0.14.0

type MessageHandler 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.FanoutMessageHandler corresponding to that Channel.

func NewMessageHandler added in v0.14.0

func NewMessageHandler(_ context.Context, logger *zap.Logger, messageDispatcher channel.MessageDispatcher, reporter channel.StatsReporter) *MessageHandler

NewHandler creates a new Handler.

func NewMessageHandlerWithConfig added in v0.19.0

func NewMessageHandlerWithConfig(_ context.Context, logger *zap.Logger, messageDispatcher channel.MessageDispatcher, conf Config, reporter channel.StatsReporter) (*MessageHandler, error)

NewMessageHandlerWithConfig 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 (*MessageHandler) CountChannelHandlers added in v0.27.0

func (h *MessageHandler) CountChannelHandlers() int

func (*MessageHandler) DeleteChannelHandler added in v0.19.0

func (h *MessageHandler) DeleteChannelHandler(host string)

func (*MessageHandler) GetChannelHandler added in v0.19.0

func (h *MessageHandler) GetChannelHandler(host string) fanout.MessageHandler

func (*MessageHandler) ServeHTTP added in v0.14.0

func (h *MessageHandler) ServeHTTP(response http.ResponseWriter, request *http.Request)

ServeHTTP delegates the actual handling of the request to a fanout.MessageHandler, based on the request's channel key.

func (*MessageHandler) SetChannelHandler added in v0.19.0

func (h *MessageHandler) SetChannelHandler(host string, handler fanout.MessageHandler)

type MultiChannelMessageHandler added in v0.19.0

type MultiChannelMessageHandler interface {
	SetChannelHandler(host string, handler fanout.MessageHandler)
	DeleteChannelHandler(host string)
	GetChannelHandler(host string) fanout.MessageHandler
	CountChannelHandlers() int

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL