Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client interface {
Publish(subject string, data []byte) error
Subscribe(subject string, handler func(data []byte)) (*nats.Subscription, error)
Close()
}
func NewClient ¶
func NewClient(cfg NATSConfig) (Client, error)
NewClient creates and connects a new NATS client.
type ClientImpl ¶
type ClientImpl struct {
// contains filtered or unexported fields
}
func (*ClientImpl) Close ¶
func (n *ClientImpl) Close()
Close cleanly shuts down the NATS connection.
func (*ClientImpl) Publish ¶
func (n *ClientImpl) Publish(subject string, data []byte) error
Publish sends a message to the given subject.
func (*ClientImpl) Subscribe ¶
func (n *ClientImpl) Subscribe(subject string, handler func(data []byte)) (*nats.Subscription, error)
Subscribe listens for messages on a subject and handles them with the given callback.
type NATSConfig ¶
NATSConfig holds config values for the NATS connection.
Click to show internal directories.
Click to hide internal directories.