broker

package
v0.0.0-...-0010da6 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2019 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// V02TTLAttribute is the name of the CloudEvents 0.2 extension attribute used to store the
	// Broker's TTL (number of times a single event can reply through a Broker continuously).
	V02TTLAttribute = "knativebrokerttl"
)

Variables

This section is empty.

Functions

func SendingContext

func SendingContext(ctx context.Context, tctx cehttp.TransportContext, targetURI *url.URL) context.Context

SendingContext creates the context to use when sending a Cloud Event with ceclient.Client. It sets the target and attaches a filtered set of headers from the initial request.

func SetTTL

func SetTTL(ctx cloudevents.EventContext, ttl interface{}) cloudevents.EventContext

SetTTL sets the TTL into the EventContext. ttl should be a positive integer.

Types

type Receiver

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

Receiver parses Cloud Events, determines if they pass a filter, and sends them to a subscriber.

func New

func New(logger *zap.Logger, client client.Client) (*Receiver, error)

New creates a new Receiver and its associated MessageReceiver. The caller is responsible for Start()ing the returned MessageReceiver.

func (*Receiver) Start

func (r *Receiver) Start(stopCh <-chan struct{}) error

Start begins to receive messages 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.

This method will block until a message is received on the stop channel.

Jump to

Keyboard shortcuts

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