broker

package
Version: v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2022 License: Apache-2.0 Imports: 6 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(opts ...Option) *broker

func Publish

func Publish(topic string, payload []byte) error

func Subscribe

func Subscribe(topic string) (<-chan []byte, error)

func Unsubscribe

func Unsubscribe(topic string, sub <-chan []byte) error

Types

type Broker

type Broker interface {
	Close() error
	Publish(topic string, payload []byte) error
	Subscribe(topic string) (<-chan []byte, error)
	Unsubscribe(topic string, sub <-chan []byte) error
}

Broker is the message broker

var (
	Default Broker = newBroker()
)

type Option

type Option func(o *Options)

func Client

func Client(c client.Client) Option

func Persist

func Persist(b bool) Option

func Proxy

func Proxy(b bool) Option

type Options

type Options struct {
	Client  client.Client
	Proxy   bool
	Persist bool
}

Jump to

Keyboard shortcuts

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