broker

package
v0.9.5 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2020 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrBrokerClosed = errors.New("broker: broker closed")

ErrBrokerClosed indicates that the broker was closed by a call to Close.

Functions

This section is empty.

Types

type Broker

type Broker interface {
	// Publish publishes a Publishable message on the broker.
	Publish(ctx context.Context, message Publishable) error
	// StartConsumer consumes messages on a broker. This method is blocking and
	// will always return with ErrBrokerClosed after calls to Close.
	StartConsumer(handlers map[string]func([]byte) error, errorHandler func(msgType string, msgBody []byte, err error)) error
	// Close closes the broker.
	Close() error
}

Broker is capable of publishing and consuming Publishable messages.

type Publishable

type Publishable interface {
	Type() string
	Marshal() ([]byte, error)
	Unmarshal([]byte) error
}

Publishable represents an enty capable of being published and consumed by a Broker.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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