Documentation ¶
Index ¶
- Constants
- Variables
- func ReportEventCountMetricsForDispatchError(err error, reporter StatsReporter, args *ReportArgs)
- type ChannelReference
- type DispatchExecutionInfo
- type MessageDispatcher
- type MessageDispatcherImpl
- type MessageReceiver
- type MessageReceiverOptions
- type ReportArgs
- type ResolveChannelFromHostFunc
- type StatsReporter
- type UnbufferedMessageReceiverFunc
- type UnknownChannelError
- type UnknownHostError
Constants ¶
const ( // noDuration signals that the dispatch step hasn't started NoDuration = -1 NoResponse = -1 )
const ( // LabelUniqueName is the label for the unique name per stats_reporter instance. LabelUniqueName = "unique_name" // LabelContainerName is the label for the immutable name of the container. LabelContainerName = "container_name" )
Variables ¶
var ( ContainerTagKey = tag.MustNewKey(LabelContainerName) UniqueTagKey = tag.MustNewKey(LabelUniqueName) )
Functions ¶
func ReportEventCountMetricsForDispatchError ¶ added in v0.19.0
func ReportEventCountMetricsForDispatchError(err error, reporter StatsReporter, args *ReportArgs)
Types ¶
type ChannelReference ¶
ChannelReference references a Channel within the cluster by name and namespace.
func ParseChannel ¶
func ParseChannel(host string) (ChannelReference, error)
ParseChannel converts the channel's hostname into a channel reference.
func (*ChannelReference) String ¶
func (r *ChannelReference) String() string
type DispatchExecutionInfo ¶ added in v0.19.0
type MessageDispatcher ¶
type MessageDispatcher interface { // DispatchMessage dispatches an event to a destination over HTTP. // // The destination and reply are URLs. DispatchMessage(ctx context.Context, message cloudevents.Message, additionalHeaders nethttp.Header, destination *url.URL, reply *url.URL, deadLetter *url.URL) (*DispatchExecutionInfo, error) // DispatchMessageWithRetries dispatches an event to a destination over HTTP. // // The destination and reply are URLs. DispatchMessageWithRetries(ctx context.Context, message cloudevents.Message, additionalHeaders nethttp.Header, destination *url.URL, reply *url.URL, deadLetter *url.URL, config *kncloudevents.RetryConfig) (*DispatchExecutionInfo, error) }
type MessageDispatcherImpl ¶ added in v0.14.0
type MessageDispatcherImpl struct {
// contains filtered or unexported fields
}
MessageDispatcherImpl dispatches events to a destination over HTTP.
func NewMessageDispatcher ¶
func NewMessageDispatcher(logger *zap.Logger) *MessageDispatcherImpl
NewMessageDispatcherFromConfig creates a new Message dispatcher based on config.
func NewMessageDispatcherFromSender ¶ added in v0.15.0
func NewMessageDispatcherFromSender(logger *zap.Logger, sender *kncloudevents.HTTPMessageSender) *MessageDispatcherImpl
NewMessageDispatcherFromConfig creates a new event dispatcher.
func (*MessageDispatcherImpl) DispatchMessage ¶ added in v0.14.0
func (d *MessageDispatcherImpl) DispatchMessage(ctx context.Context, message cloudevents.Message, additionalHeaders nethttp.Header, destination *url.URL, reply *url.URL, deadLetter *url.URL) (*DispatchExecutionInfo, error)
func (*MessageDispatcherImpl) DispatchMessageWithRetries ¶ added in v0.17.0
func (d *MessageDispatcherImpl) DispatchMessageWithRetries(ctx context.Context, message cloudevents.Message, additionalHeaders nethttp.Header, destination *url.URL, reply *url.URL, deadLetter *url.URL, retriesConfig *kncloudevents.RetryConfig) (*DispatchExecutionInfo, error)
type MessageReceiver ¶
type MessageReceiver struct {
// contains filtered or unexported fields
}
MessageReceiver starts a server to receive new events for the channel dispatcher. The new event is emitted via the receiver function.
func NewMessageReceiver ¶
func NewMessageReceiver(receiverFunc UnbufferedMessageReceiverFunc, logger *zap.Logger, reporter StatsReporter, opts ...MessageReceiverOptions) (*MessageReceiver, error)
NewMessageReceiver creates an event receiver passing new events to the receiverFunc.
func (*MessageReceiver) ServeHTTP ¶ added in v0.14.0
func (r *MessageReceiver) ServeHTTP(response nethttp.ResponseWriter, request *nethttp.Request)
func (*MessageReceiver) Start ¶
func (r *MessageReceiver) Start(ctx context.Context) error
Start begins to receive events for the receiver.
Only HTTP POST requests to the root path (/) are accepted. If other paths or methods are needed, use the HandleRequest method directly with another HTTP server.
type MessageReceiverOptions ¶ added in v0.14.0
type MessageReceiverOptions func(*MessageReceiver) error
ReceiverOptions provides functional options to MessageReceiver function.
func ResolveMessageChannelFromHostHeader ¶ added in v0.14.0
func ResolveMessageChannelFromHostHeader(hostToChannelFunc ResolveChannelFromHostFunc) MessageReceiverOptions
ResolveMessageChannelFromHostHeader is a ReceiverOption for NewMessageReceiver which enables the caller to overwrite the default behaviour defined by ParseChannel function.
type ReportArgs ¶ added in v0.19.0
type ResolveChannelFromHostFunc ¶
type ResolveChannelFromHostFunc func(string) (ChannelReference, error)
ResolveChannelFromHostFunc function enables EventReceiver to get the Channel Reference from incoming request HostHeader before calling receiverFunc. Returns UnknownHostError if the channel is not found, otherwise returns a generic error.
type StatsReporter ¶ added in v0.19.0
type StatsReporter interface { ReportEventCount(args *ReportArgs, responseCode int) error ReportEventDispatchTime(args *ReportArgs, responseCode int, d time.Duration) error }
func NewStatsReporter ¶ added in v0.19.0
func NewStatsReporter(container, uniqueName string) StatsReporter
NewStatsReporter creates a reporter that collects and reports channel metrics.
type UnbufferedMessageReceiverFunc ¶ added in v0.14.0
type UnbufferedMessageReceiverFunc func(context.Context, ChannelReference, binding.Message, []binding.Transformer, nethttp.Header) error
UnbufferedMessageReceiverFunc is the function to be called for handling the message. The provided message is not buffered, so it can't be safely read more times. When you perform the write (or the buffering) of the Message, you must use the transformers provided as parameters. This function is responsible for invoking Message.Finish().
type UnknownChannelError ¶ added in v0.10.0
type UnknownChannelError struct {
Channel ChannelReference
}
UnknownChannelError represents the error when an event is received by a channel dispatcher for a channel that does not exist.
func (*UnknownChannelError) Error ¶ added in v0.10.0
func (e *UnknownChannelError) Error() string
type UnknownHostError ¶ added in v0.14.0
type UnknownHostError string
UnknownHostError represents the error when a ResolveMessageChannelFromHostHeader func cannot resolve an host
func (UnknownHostError) Error ¶ added in v0.14.0
func (e UnknownHostError) Error() string
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
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.
|
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. |
Package multichannelfanout provides an http.Handler that takes in one request to a Knative Channel and fans it out to N other requests.
|
Package multichannelfanout provides an http.Handler that takes in one request to a Knative Channel and fans it out to N other requests. |