cnats

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	REQ_ID = "reqID"
)

Variables

This section is empty.

Functions

func ConnectClose

func ConnectClose()

func GetMsg

func GetMsg() *nats.Msg

func GetTimeout

func GetTimeout(tod ...time.Duration) time.Duration

func NewPool

func NewPool(replySubject string, config cfacade.ProfileJSON, isConnect bool)

func ReconnectDelay

func ReconnectDelay() time.Duration

func ReleaseMsg

func ReleaseMsg(msg *nats.Msg)

Types

type Connect

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

func GetConnect

func GetConnect() *Connect

func GetPool

func GetPool() []*Connect

func NewConnect

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

func (*Connect) Address

func (p *Connect) Address() string

func (*Connect) Close

func (p *Connect) Close()

func (*Connect) Connect

func (p *Connect) Connect()

func (*Connect) GetID

func (p *Connect) GetID() int

func (*Connect) MaxReconnects

func (p *Connect) MaxReconnects() int

func (*Connect) QueueSubscribe

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

func (*Connect) Request

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

func (*Connect) RequestSync

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

func (*Connect) Subs

func (p *Connect) Subs() []*nats.Subscription

func (*Connect) Subscribe

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

type OptionFunc

type OptionFunc func(o *options)

func WithAddress

func WithAddress(address string) OptionFunc

func WithAuth

func WithAuth(user, password string) OptionFunc

func WithIsStats

func WithIsStats(isStats bool) OptionFunc

func WithParams

func WithParams(maxReconnects int) OptionFunc

Jump to

Keyboard shortcuts

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