mq

package
v0.5.11 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrCannotConnectToNats = errors.New("Cannot connect to NATS server in Mq")
	ErrCannotConnectToMq   = errors.New("Cannot connect to Mq server by NATS conn")
)
View Source
var (
	ErrNotImplemented = errors.New("Function not implemented")
)

Functions

This section is empty.

Types

type CbQueueSubscribe

type CbQueueSubscribe func(subj string, q string, data []byte)

queue 订阅模式的回调

type CbSubscribe

type CbSubscribe func(subj string, data []byte)

订阅得到回应的回调

type Eventbus

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

func NewEventbus

func NewEventbus(addrs []string, username, password string) (*Eventbus, error)

func (*Eventbus) AsyncPub

func (self *Eventbus) AsyncPub(subj string, content []byte, timeout time.Duration) error

func (*Eventbus) Close

func (self *Eventbus) Close()

func (*Eventbus) GetOriginConn

func (self *Eventbus) GetOriginConn() *nats.Conn

func (*Eventbus) QSub

func (self *Eventbus) QSub(subj, q string, cb CbQueueSubscribe) error

func (*Eventbus) Sub

func (self *Eventbus) Sub(subj string, cb CbSubscribe) error

type Mq

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

func NewMq

func NewMq(addrs []string, username, password string, cluster_id, client_id string) (*Mq, error)

PubAckWait MaxPubAcksInflight SetConnectionLostHandler

func (*Mq) AsyncPub

func (self *Mq) AsyncPub(subj string, msg []byte) error

func (*Mq) Close

func (self *Mq) Close()

func (*Mq) Pub

func (self *Mq) Pub(subj string, msg []byte) error

func (*Mq) QSub

func (self *Mq) QSub(subj, qname, durable string, cb CbSubscribe) error

func (*Mq) Sub

func (self *Mq) Sub(subj, durable string, cb CbSubscribe) error

Jump to

Keyboard shortcuts

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