broker

package
v0.0.19 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Name = "broker"

Functions

func List

func List() (dt map[string]Factory)

func Register

func Register(name string, broker Factory)

Types

type Broker

type Broker interface {
	Pub(topic string, msg *Message, opts *PubOpts) error
	Sub(topic string, handler Handler, opts *SubOpts) error
	String() string
}

func Get

func Get(names ...string) Broker

type Cfg

type Cfg struct {
	Driver string `json:"driver"`
}

func GetDefaultCfg

func GetDefaultCfg() Cfg

type Factory

type Factory func(cfg map[string]interface{}) (Broker, error)

type Handler

type Handler func(msg *Message) error

type Message

type Message struct {
	Header    map[string]string
	ID        string
	Body      []byte
	Timestamp int64
	Attempts  uint16
	Priority  uint8
	ReplyTo   string
}

type PubOpts

type PubOpts struct {
	Ctx context.Context
}

type SubOpts

type SubOpts struct {
	Ctx     context.Context
	Topic   string
	Queue   string
	AutoAck bool
	Broker  Broker
}

Jump to

Keyboard shortcuts

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