channel

package
v0.13.3-mod Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2020 License: Apache-2.0 Imports: 20 Imported by: 0

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 AppendHistory

func AppendHistory(event *cloudevents.Event, host string)

AppendToHistory appends a new host at the end of the list of hosts of the event history.

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 DeliveryOptions

type DeliveryOptions struct {
	// DeadLetterSink is the sink receiving events that could not be dispatched.
	DeadLetterSink string
}

DeliveryOptions are the delivery options supported by this dispatcher

type Dispatcher

type Dispatcher interface {
	// DispatchEvent dispatches an event to a destination over HTTP.
	//
	// The destination and reply are URLs.
	DispatchEvent(ctx context.Context, event cloudevents.Event, destination, reply string) error

	// DispatchEventWithDelivery dispatches an event to a destination over HTTP with delivery options
	//
	// The destination and reply are URLs.
	DispatchEventWithDelivery(ctx context.Context, event cloudevents.Event, destination, reply string, delivery *DeliveryOptions) error
}

type EventDispatcher

type EventDispatcher struct {
	// contains filtered or unexported fields
}

EventDispatcher dispatches events to a destination over HTTP.

func NewEventDispatcher

func NewEventDispatcher(logger *zap.Logger) *EventDispatcher

NewEventDispatcher creates a new event dispatcher that can dispatch events to HTTP destinations.

func NewEventDispatcherFromConfig

func NewEventDispatcherFromConfig(logger *zap.Logger, config EventDispatcherConfig) *EventDispatcher

NewEventDispatcherFromConfig creates a new event dispatcher based on config.

func (*EventDispatcher) DispatchEvent

func (d *EventDispatcher) DispatchEvent(ctx context.Context, event cloudevents.Event, destination, reply string) error

DispatchEvent dispatches an event to a destination over HTTP.

The destination and reply are URLs.

func (*EventDispatcher) DispatchEventWithDelivery

func (d *EventDispatcher) DispatchEventWithDelivery(ctx context.Context, event cloudevents.Event, destination, reply string, delivery *DeliveryOptions) error

DispatchEventWithDelivery dispatches an event to a destination over HTTP with delivery options

The destination and reply are URLs.

type EventDispatcherConfig

type EventDispatcherConfig struct {
	kncloudevents.ConnectionArgs
}

EventDispatcherConfig holds the configuration parameters for the event dispatcher.

func NewEventDisPatcherConfigFromConfigMap

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

NewEventDisPatcherConfigFromConfigMap converts a k8s configmap into EventDispatcherConfig.

type EventDispatcherConfigStore

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

EventDispatcherConfigStore loads/unloads untyped configuration from configmap.

func NewEventDispatcherConfigStore

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

NewEventDispatcherConfigStore creates a configuration Store

func (*EventDispatcherConfigStore) GetConfig

GetConfig returns the current config in the store.

type EventReceiver

type EventReceiver struct {
	// contains filtered or unexported fields
}

EventReceiver starts a server to receive new events for the channel dispatcher. The new event is emitted via the receiver function.

func NewEventReceiver

func NewEventReceiver(receiverFunc ReceiverFunc, logger *zap.Logger, opts ...ReceiverOptions) (*EventReceiver, error)

NewEventReceiver creates an event receiver passing new events to the receiverFunc.

func (*EventReceiver) ServeHTTP

func (r *EventReceiver) ServeHTTP(ctx context.Context, event cloudevents.Event, resp *cloudevents.EventResponse) error

func (*EventReceiver) Start

func (r *EventReceiver) 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 ReceiverFunc

ReceiverFunc is the function to be called for handling the event.

type ReceiverOptions

type ReceiverOptions func(*EventReceiver) error

ReceiverOptions provides functional options to EventReceiver function.

func ResolveChannelFromHostHeader

func ResolveChannelFromHostHeader(hostToChannelFunc ResolveChannelFromHostFunc) ReceiverOptions

ResolveChannelFromHostHeader is a ReceiverOption for NewEventReceiver 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.

type UnknownChannelError

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

func (e *UnknownChannelError) 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.Handler.
Package swappable provides an http.Handler that delegates all HTTP requests to an underlying multichannelfanout.Handler.

Jump to

Keyboard shortcuts

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