natsLib

package
v0.0.0-...-bdb8b81 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetMsgChannel

func GetMsgChannel() chan *nats.Msg

func HandleMsg

func HandleMsg(msg *nats.Msg) error

func Publish

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

func RegisterMsgHandler

func RegisterMsgHandler(api NatsMsgApi, handler NatsMsgHandler)

func Start

func Start(name, user, passwd string, serverList []string)

func Stop

func Stop()

func Subscribe

func Subscribe(subject string) error

Types

type NatsClient

type NatsClient struct {
	MsgChannel chan *nats.Msg
	// contains filtered or unexported fields
}

func NewNatsClient

func NewNatsClient(name, user, passwd string, serverList []string) *NatsClient

func (*NatsClient) Close

func (this *NatsClient) Close()

func (*NatsClient) HandleMsg

func (this *NatsClient) HandleMsg(msg *nats.Msg) error

func (*NatsClient) Publish

func (this *NatsClient) Publish(subject string, api NatsMsgApi, data interface{}) error

func (*NatsClient) RegisterMsgHandler

func (this *NatsClient) RegisterMsgHandler(api NatsMsgApi, handler NatsMsgHandler)

func (*NatsClient) Subscribe

func (this *NatsClient) Subscribe(subject string) error

type NatsMsgApi

type NatsMsgApi int32
var (
	NatsMsgApiUnknown NatsMsgApi = 0
)

type NatsMsgData

type NatsMsgData struct {
	Api  NatsMsgApi
	Data interface{}
}

type NatsMsgHandler

type NatsMsgHandler func(*NatsMsgData) error

Jump to

Keyboard shortcuts

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