protocol

package
v2.0.0-preview7 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2020 License: Apache-2.0 Imports: 4 Imported by: 115

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ResultAs = errors.As

As finds the first error in err's chain that matches target, and if so, sets target to that error value and returns true.

The chain consists of err itself followed by the sequence of errors obtained by repeatedly calling Unwrap.

An error matches target if the error's concrete value is assignable to the value pointed to by target, or if the error has a method As(interface{}) bool such that As(target) returns true. In the latter case, the As method is responsible for setting target.

As will panic if target is not a non-nil pointer to either a type that implements error, or to any interface type. As returns false if err is nil. (text from errors/wrap.go)

View Source
var ResultIs = errors.Is

Is reports whether any error in err's chain matches target.

The chain consists of err itself followed by the sequence of errors obtained by repeatedly calling Unwrap.

An error is considered to match a target if it is equal to that target or if it implements a method Is(error) bool such that Is(target) returns true. (text from errors/wrap.go)

Functions

This section is empty.

Types

type Closer

type Closer interface {
	Close(ctx context.Context) error
}

Closer is the common interface for things that can be closed.

type ErrTransportMessageConversion

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

ErrTransportMessageConversion is an error produced when the transport message can not be converted.

func NewErrTransportMessageConversion

func NewErrTransportMessageConversion(transport, message string, handled, fatal bool) *ErrTransportMessageConversion

NewErrMessageEncodingUnknown makes a new ErrMessageEncodingUnknown.

func (*ErrTransportMessageConversion) Error

Error implements error.Error

func (*ErrTransportMessageConversion) Handled

func (e *ErrTransportMessageConversion) Handled() bool

Handled reports if this error should be considered accepted and no further action.

func (*ErrTransportMessageConversion) IsFatal

func (e *ErrTransportMessageConversion) IsFatal() bool

IsFatal reports if this error should be considered fatal.

type Opener

type Opener interface {
	// Blocking call. Context is used to cancel.
	OpenInbound(ctx context.Context) error
}

Opener is the common interface for things that need to be opened.

type ReceiveCloser

type ReceiveCloser interface {
	Receiver
	Closer
}

ReceiveCloser is a Receiver that can be closed.

type Receiver

type Receiver interface {
	// Receive blocks till a message is received or ctx expires.
	//
	// A non-nil error means the receiver is closed.
	// io.EOF means it closed cleanly, any other value indicates an error.
	Receive(ctx context.Context) (binding.Message, error)
}

Receiver receives messages.

type Requester

type Requester interface {
	// Request sends m like Sender.Send() but also arranges to receive a response.
	Request(ctx context.Context, m binding.Message) (binding.Message, error)
}

Requester sends a message and receives a response

Optional interface that may be implemented by protocols that support request/response correlation.

type RequesterCloser

type RequesterCloser interface {
	Requester
	Closer
}

RequesterCloser is a Requester that can be closed.

type Responder

type Responder interface {
	// Receive blocks till a message is received or ctx expires.
	//
	// A non-nil error means the receiver is closed.
	// io.EOF means it closed cleanly, any other value indicates an error.
	Respond(ctx context.Context) (binding.Message, ResponseFn, error)
}

Responder receives messages and is given a callback to respond.

type ResponderCloser

type ResponderCloser interface {
	Responder
	Closer
}

ResponderCloser is a Responder that can be closed.

type ResponseFn

type ResponseFn func(ctx context.Context, m binding.Message, r Result) error

ResponseFn is the function callback provided from Responder.Respond to allow for a receiver to "reply" to a message it receives.

type Result

type Result error

Result leverages go's 1.13 error wrapping.

func NewResult

func NewResult(messageFmt string, args ...interface{}) Result

type SendCloser

type SendCloser interface {
	Sender
	Closer
}

SendCloser is a Sender that can be closed.

type Sender

type Sender interface {
	// Send a message.
	//
	// Send returns when the "outbound" message has been sent. The Sender may
	// still be expecting acknowledgment or holding other state for the message.
	//
	// m.Finish() is called when sending is finished (both succeeded or failed):
	// expected acknowledgments (or errors) have been received, the Sender is
	// no longer holding any state for the message.
	// m.Finish() may be called during or after Send().
	Send(ctx context.Context, m binding.Message) error
}

Sender sends messages.

Directories

Path Synopsis
Module amqp implements an AMQP binding using pack.ag/amqp module
Module amqp implements an AMQP binding using pack.ag/amqp module
Package channel implements the CloudEvent transport implementation using go chan.
Package channel implements the CloudEvent transport implementation using go chan.
Package nats implements the CloudEvent transport implementation using NATS.
Package nats implements the CloudEvent transport implementation using NATS.
Package stan implements the CloudEvent transport implementation using NATS Streaming.
Package stan implements the CloudEvent transport implementation using NATS Streaming.
Package test provides re-usable functions for binding tests.
Package test provides re-usable functions for binding tests.

Jump to

Keyboard shortcuts

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