cherryNats

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: May 9, 2026 License: MIT Imports: 9 Imported by: 2

Documentation

Index

Constants

View Source
const (
	REQ_ID = "reqID"
)

Variables

This section is empty.

Functions

func GetNatsMsg added in v1.4.22

func GetNatsMsg() *nats.Msg

func NewReqID added in v1.4.22

func NewReqID() uint64

func NewStringReqID added in v1.4.22

func NewStringReqID() string

func PoolClose added in v1.4.22

func PoolClose()

func Publish added in v1.4.22

func Publish(subject string, data []byte) error

func PublishMsg added in v1.4.22

func PublishMsg(msg *nats.Msg) error

func ReleaseNatsMsg added in v1.4.22

func ReleaseNatsMsg(natsMsg *nats.Msg)

func ReplySync added in v1.4.22

func ReplySync(reqID, reply string, data []byte) error

func Request added in v1.4.22

func Request(subject string, data []byte, timeout ...time.Duration) ([]byte, error)

func RequestSync added in v1.4.22

func RequestSync(reqID, subject string, data []byte, timeout ...time.Duration) ([]byte, error)

func Subscribe added in v1.4.22

func Subscribe(subject string, cb nats.MsgHandler) error

Types

type Connect added in v1.4.4

type Connect struct {
	*nats.Conn
	// contains filtered or unexported fields
}

func NewConnect added in v1.4.4

func NewConnect(id int, replySubject string, opts ...OptionFunc) *Connect

func (*Connect) Address added in v1.4.4

func (p *Connect) Address() string

func (*Connect) Close added in v1.4.4

func (p *Connect) Close()

func (*Connect) Connect added in v1.4.4

func (p *Connect) Connect()

func (*Connect) GetID added in v1.4.4

func (p *Connect) GetID() int

func (*Connect) MaxReconnects added in v1.4.4

func (p *Connect) MaxReconnects() int

func (*Connect) QueueSubscribe added in v1.4.4

func (p *Connect) QueueSubscribe(subject, queue string, cb nats.MsgHandler) error

func (*Connect) ReconnectDelay added in v1.4.22

func (p *Connect) ReconnectDelay() time.Duration

func (*Connect) ReplySync added in v1.4.22

func (p *Connect) ReplySync(reqID, reply string, data []byte) error

func (*Connect) Request added in v1.4.4

func (p *Connect) Request(subject string, data []byte, tod ...time.Duration) ([]byte, error)

func (*Connect) RequestSync added in v1.4.4

func (p *Connect) RequestSync(reqID, subject string, data []byte, tod ...time.Duration) ([]byte, error)

func (*Connect) RequestTimeout added in v1.4.22

func (p *Connect) RequestTimeout() time.Duration

func (*Connect) StatsInterval added in v1.4.22

func (p *Connect) StatsInterval() time.Duration

func (*Connect) Subscribe added in v1.4.8

func (p *Connect) Subscribe(subject string, cb nats.MsgHandler) error

func (*Connect) Timeout added in v1.4.22

func (p *Connect) Timeout(tod ...time.Duration) time.Duration

type ConnectPool added in v1.4.22

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

func InitPool added in v1.4.22

func InitPool(replySubject string, config cfacade.ProfileJSON, isConnect bool) *ConnectPool

func NewConnectPool added in v1.4.22

func NewConnectPool(replySubject string, config cfacade.ProfileJSON, isConnect bool) *ConnectPool

func Pool added in v1.4.22

func Pool() *ConnectPool

func (*ConnectPool) GetConnect added in v1.4.22

func (p *ConnectPool) GetConnect() *Connect

type OptionFunc

type OptionFunc func(o *options)

func WithAddress

func WithAddress(address string) OptionFunc

func WithAuth

func WithAuth(user, password string) OptionFunc

func WithIsStats added in v1.4.4

func WithIsStats(isStats bool) OptionFunc

func WithParams

func WithParams(maxReconnects int) OptionFunc

func WithReconnectDelay added in v1.4.22

func WithReconnectDelay(delay time.Duration) OptionFunc

func WithRequestTimeout added in v1.4.22

func WithRequestTimeout(timeout time.Duration) OptionFunc

func WithStatsInterval added in v1.4.22

func WithStatsInterval(seconds int) OptionFunc

Jump to

Keyboard shortcuts

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