channel

package
v0.15.4 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2020 License: Apache-2.0 Imports: 23 Imported by: 26

Documentation

Index

Constants

View Source
const (
	// EventHistory is the header containing all channel hosts traversed by the event.
	// This is an experimental header: https://github.com/knative/eventing/issues/638.
	EventHistory          = "knativehistory"
	EventHistorySeparator = "; "
)
View Source
const EventDispatcherConfigMap = "config-imc-event-dispatcher"

EventDispatcherConfigMap is the name of the configmap for event dispatcher.

Variables

This section is empty.

Functions

func AddHistory added in v0.14.0

func AddHistory(host string) binding.Transformer

Types

type ChannelReference

type ChannelReference struct {
	Namespace string
	Name      string
}

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 EventDispatcherConfig added in v0.13.0

type EventDispatcherConfig struct {
	kncloudevents.ConnectionArgs
}

EventDispatcherConfig holds the configuration parameters for the event dispatcher.

func NewEventDisPatcherConfigFromConfigMap added in v0.13.0

func NewEventDisPatcherConfigFromConfigMap(config *corev1.ConfigMap) (EventDispatcherConfig, error)

NewEventDisPatcherConfigFromConfigMap converts a k8s configmap into EventDispatcherConfig.

type EventDispatcherConfigStore added in v0.13.0

type EventDispatcherConfigStore struct {
	*knconfigmap.UntypedStore
	// contains filtered or unexported fields
}

EventDispatcherConfigStore loads/unloads untyped configuration from configmap.

func NewEventDispatcherConfigStore added in v0.13.0

func NewEventDispatcherConfigStore(logger knconfigmap.Logger, onAfterStore ...func(name string, value interface{})) *EventDispatcherConfigStore

NewEventDispatcherConfigStore creates a configuration Store

func (*EventDispatcherConfigStore) GetConfig added in v0.13.0

GetConfig returns the current config in the store.

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) 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

NewMessageDispatcher creates a new Message dispatcher that can dispatch events to HTTP destinations.

func NewMessageDispatcherFromConfig added in v0.14.0

func NewMessageDispatcherFromConfig(logger *zap.Logger, config EventDispatcherConfig) *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 Message dispatcher from a sender.

func (*MessageDispatcherImpl) DispatchMessage added in v0.14.0

func (d *MessageDispatcherImpl) DispatchMessage(ctx context.Context, initialMessage cloudevents.Message, initialAdditionalHeaders nethttp.Header, destination *url.URL, reply *url.URL, deadLetter *url.URL) 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, 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 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 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 {
	// contains filtered or unexported fields
}

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

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.
Package swappable provides an http.Handler that delegates all HTTP requests to an underlying multichannelfanout.MessageHandler.
Package swappable provides an http.Handler that delegates all HTTP requests to an underlying multichannelfanout.MessageHandler.

Jump to

Keyboard shortcuts

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