Documentation ¶
Index ¶
- Constants
- type NatsClient
- func (n *NatsClient) Publish(topic string, data interface{}) error
- func (n *NatsClient) Release()
- func (n *NatsClient) Request(topic string, data []byte, msec time.Duration) ([]byte, error)
- func (n *NatsClient) Subscribe(topic string, handler NatsMsgHandler) error
- func (n *NatsClient) SubscribeRsp(topic string, handler NatsMsgRspHandler) error
- type NatsMsgHandler
- type NatsMsgRspHandler
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) 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 ¶
Click to show internal directories.
Click to hide internal directories.