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: 13 Imported by: 22



Package fanout provides an http.Handler that takes in one request and fans it out to N other requests, based on a list of Subscriptions. Logically, it represents all the Subscriptions to a single Knative Channel. It will normally be used in conjunction with multichannelfanout.MessageHandler, which contains multiple fanout.MessageHandler, each corresponding to a single Knative Channel.



This section is empty.


This section is empty.


func ParseDispatchResultAndReportMetrics added in v0.24.0

func ParseDispatchResultAndReportMetrics(result DispatchResult, reporter channel.StatsReporter, reportArgs channel.ReportArgs) error

ParseDispatchResultAndReportMetric processes the dispatch result and records the related channel metrics with the appropriate context


type Config

type Config struct {
	Subscriptions []Subscription `json:"subscriptions"`
	// AsyncHandler controls whether the Subscriptions are called synchronous or asynchronously.
	// It is expected to be false when used as a sidecar.
	AsyncHandler bool `json:"asyncHandler,omitempty"`

Config for a fanout.MessageHandler.

type DispatchResult added in v0.24.0

type DispatchResult struct {
	// contains filtered or unexported fields

func NewDispatchResult added in v0.24.0

func NewDispatchResult(err error, info *channel.DispatchExecutionInfo) DispatchResult

func (DispatchResult) Error added in v0.24.0

func (d DispatchResult) Error() error

func (DispatchResult) Info added in v0.24.0

type FanoutMessageHandler added in v0.19.0

type FanoutMessageHandler struct {
	// contains filtered or unexported fields

MessageHandler is a http.Handler that takes a single request in and fans it out to N other servers.

func NewFanoutMessageHandler added in v0.19.0

func NewFanoutMessageHandler(logger *zap.Logger, messageDispatcher channel.MessageDispatcher, config Config, reporter channel.StatsReporter) (*FanoutMessageHandler, error)

func (*FanoutMessageHandler) GetSubscriptions added in v0.19.0

func (f *FanoutMessageHandler) GetSubscriptions(ctx context.Context) []Subscription

func (*FanoutMessageHandler) ServeHTTP added in v0.19.0

func (f *FanoutMessageHandler) ServeHTTP(response nethttp.ResponseWriter, request *nethttp.Request)

func (*FanoutMessageHandler) SetSubscriptions added in v0.19.0

func (f *FanoutMessageHandler) SetSubscriptions(ctx context.Context, subs []Subscription)

type MessageHandler added in v0.14.0

type MessageHandler interface {
	SetSubscriptions(ctx context.Context, subs []Subscription)
	GetSubscriptions(ctx context.Context) []Subscription

MessageHandler is an http.Handler but has methods for managing the fanout Subscriptions. Get/Set methods are synchronized, and GetSubscriptions returns a copy of the Subscriptions, so you can use it to fetch a snapshot and use it after that safely.

type Subscription added in v0.17.0

type Subscription struct {
	Subscriber  *url.URL
	Reply       *url.URL
	DeadLetter  *url.URL
	RetryConfig *kncloudevents.RetryConfig

func SubscriberSpecToFanoutConfig added in v0.17.0

func SubscriberSpecToFanoutConfig(sub eventingduckv1.SubscriberSpec) (*Subscription, error)

Jump to

Keyboard shortcuts

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