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.EventHandler, which contains multiple fanout.EventHandler, 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
ParseDispatchResultAndReportMetrics processes the dispatch result and records the related channel metrics with the appropriate context
Types ¶
type Config ¶
type Config struct { Subscriptions []Subscription `json:"subscriptions"` // Deprecated: 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.EventHandler.
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 *kncloudevents.DispatchInfo) 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() *kncloudevents.DispatchInfo
type EventHandler ¶ added in v0.39.0
type EventHandler interface { nethttp.Handler SetSubscriptions(ctx context.Context, subs []Subscription) GetSubscriptions(ctx context.Context) []Subscription }
EventHandler 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 FanoutEventHandler ¶ added in v0.39.0
type FanoutEventHandler struct {
// contains filtered or unexported fields
}
FanoutEventHandler is a http.Handler that takes a single request in and fans it out to N other servers.
func NewFanoutEventHandler ¶ added in v0.39.0
func NewFanoutEventHandler( logger *zap.Logger, config Config, reporter channel.StatsReporter, eventTypeHandler *eventtype.EventTypeAutoHandler, channelRef *duckv1.KReference, channelUID *types.UID, eventDispatcher *kncloudevents.Dispatcher, receiverOpts ...channel.EventReceiverOptions, ) (*FanoutEventHandler, error)
NewFanoutEventHandler creates a new fanout.EventHandler.
func (*FanoutEventHandler) GetSubscriptions ¶ added in v0.39.0
func (f *FanoutEventHandler) GetSubscriptions(ctx context.Context) []Subscription
func (*FanoutEventHandler) ServeHTTP ¶ added in v0.39.0
func (f *FanoutEventHandler) ServeHTTP(response nethttp.ResponseWriter, request *nethttp.Request)
func (*FanoutEventHandler) SetSubscriptions ¶ added in v0.39.0
func (f *FanoutEventHandler) SetSubscriptions(ctx context.Context, subs []Subscription)
type Subscription ¶ added in v0.17.0
type Subscription struct { Subscriber duckv1.Addressable Reply *duckv1.Addressable DeadLetter *duckv1.Addressable RetryConfig *kncloudevents.RetryConfig ServiceAccount *types.NamespacedName Name string Namespace string UID types.UID }
func SubscriberSpecToFanoutConfig ¶ added in v0.17.0
func SubscriberSpecToFanoutConfig(sub eventingduckv1.SubscriberSpec) (*Subscription, error)