Documentation
¶
Overview ¶
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.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
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
Types ¶
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
func (d DispatchResult) Info() *channel.DispatchExecutionInfo
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, eventTypeHandler *eventtype.EventTypeAutoHandler, channelAddressable *duckv1.KReference, channelUID *types.UID, receiverOpts ...channel.MessageReceiverOptions, ) (*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 { nethttp.Handler 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 duckv1.Addressable Reply *duckv1.Addressable DeadLetter *duckv1.Addressable RetryConfig *kncloudevents.RetryConfig }
func SubscriberSpecToFanoutConfig ¶ added in v0.17.0
func SubscriberSpecToFanoutConfig(sub eventingduckv1.SubscriberSpec) (*Subscription, error)