exchange

package
v1.2.14 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2020 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Exchange

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

Exchange broadcasts events

func NewExchange

func NewExchange() *Exchange

NewExchange returns a new event Exchange

func (*Exchange) Forward

func (e *Exchange) Forward(ctx context.Context, envelope *events.Envelope) (err error)

Forward accepts an envelope to be direcly distributed on the exchange.

This is useful when an event is forwarded on behalf of another namespace or when the event is propagated on behalf of another publisher.

func (*Exchange) Publish

func (e *Exchange) Publish(ctx context.Context, topic string, event events.Event) (err error)

Publish packages and sends an event. The caller will be considered the initial publisher of the event. This means the timestamp will be calculated at this point and this method may read from the calling context.

func (*Exchange) Subscribe

func (e *Exchange) Subscribe(ctx context.Context, fs ...string) (ch <-chan *events.Envelope, errs <-chan error)

Subscribe to events on the exchange. Events are sent through the returned channel ch. If an error is encountered, it will be sent on channel errs and errs will be closed. To end the subscription, cancel the provided context.

Zero or more filters may be provided as strings. Only events that match *any* of the provided filters will be sent on the channel. The filters use the standard containerd filters package syntax.

Jump to

Keyboard shortcuts

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