channel

package
v0.13.1 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 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 added in v0.10.0

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

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

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

EventDispatcher dispatches events to a destination over HTTP.

func NewEventDispatcher added in v0.10.0

func NewEventDispatcher(logger *zap.Logger) *EventDispatcher

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

func NewEventDispatcherFromConfig added in v0.13.0

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

NewEventDispatcherFromConfig creates a new event dispatcher based on config.

func (*EventDispatcher) DispatchEvent added in v0.10.0

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

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 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 EventReceiver added in v0.10.0

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

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

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

func (*EventReceiver) Start added in v0.10.0

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

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

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