Documentation ¶
Index ¶
- type NatsClient
- func (c *NatsClient) ChanQueueSubscribe(subject string, queue string) (<-chan *nats.Msg, error)
- func (c *NatsClient) ChanSubscribe(subject string) (<-chan *nats.Msg, error)
- func (c *NatsClient) Publish(subject string, msg interface{}) error
- func (c *NatsClient) QueueSubscribe(subject string, queue string, callback func(msg *nats.Msg)) error
- func (c *NatsClient) Request(subject string, msg interface{}) (*nats.Msg, error)
- func (c *NatsClient) Shutdown()
- func (c *NatsClient) Subscribe(subject string, callback func(msg *nats.Msg)) error
- func (c *NatsClient) Unsubscribe(subject string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type NatsClient ¶
type NatsClient struct {
// contains filtered or unexported fields
}
NatsClient is the state of the client
func NewNatsClient ¶
func NewNatsClient(endpoint string) (*NatsClient, error)
NewNatsClient creates a new NATS client and attempts to connect to the specified endpoint
func (*NatsClient) ChanQueueSubscribe ¶
ChanQueueSubscribe to a nats subject and queue group with a channel
func (*NatsClient) ChanSubscribe ¶
func (c *NatsClient) ChanSubscribe(subject string) (<-chan *nats.Msg, error)
ChanSubscribe to a nats subject with a channel
func (*NatsClient) Publish ¶
func (c *NatsClient) Publish(subject string, msg interface{}) error
Publish sends a message to subject subscriptions
func (*NatsClient) QueueSubscribe ¶
func (c *NatsClient) QueueSubscribe(subject string, queue string, callback func(msg *nats.Msg)) error
QueueSubscribe to a nats subject and queue group with a callback
func (*NatsClient) Request ¶
func (c *NatsClient) Request(subject string, msg interface{}) (*nats.Msg, error)
Request sends a message to subject subscriptions
func (*NatsClient) Shutdown ¶
func (c *NatsClient) Shutdown()
Shutdown gracefull cleans up subscriptions and the client
func (*NatsClient) Subscribe ¶
func (c *NatsClient) Subscribe(subject string, callback func(msg *nats.Msg)) error
Subscribe to a nats subject with a callback
func (*NatsClient) Unsubscribe ¶
func (c *NatsClient) Unsubscribe(subject string) error
Unsubscribe drains a subscription
Click to show internal directories.
Click to hide internal directories.