mq

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultURL = nats.DefaultURL
)

Variables

This section is empty.

Functions

This section is empty.

Types

type NatsClient

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

func NewNatsClient

func NewNatsClient(url string, onlysub bool) (*NatsClient, error)

NewNatsClient nats connect

func (*NatsClient) Publish

func (n *NatsClient) Publish(topic string, data interface{}) error

Publish publish

func (*NatsClient) Release

func (n *NatsClient) Release()

func (*NatsClient) Request

func (n *NatsClient) Request(topic string, data []byte, msec time.Duration) ([]byte, error)

Request return reponse data, error

func (*NatsClient) Subscribe

func (n *NatsClient) Subscribe(topic string, handler NatsMsgHandler) error

Subscribe subscribe

func (*NatsClient) SubscribeRsp

func (n *NatsClient) SubscribeRsp(topic string, handler NatsMsgRspHandler) error

SubscribeRsp response the request

type NatsMsgHandler

type NatsMsgHandler func([]byte)

type NatsMsgRspHandler

type NatsMsgRspHandler func([]byte) []byte

Jump to

Keyboard shortcuts

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