Version: v0.1.15 Latest Latest

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

Go to latest
Published: Dec 9, 2020 License: MIT Imports: 6 Imported by: 0




This section is empty.


View Source
var NC *nats.Conn

NC is a connection to the nats Server


func Connect

func Connect(url string, username string, password string) (*nats.Conn, error)

Connect connects to nats server and returns instance On shutdown, you'll need to call natsconnection.NC.Drain()

func Request

func Request(ctx context.Context, subj string, data []byte, timeOut time.Duration) (*nats.Msg, error)

Request sends a message and expects a response back

func SubscribeToQueue

func SubscribeToQueue(subjBase string, queueName string, handlerRouter func(*nats.Msg))

SubscribeToQueue subscribes on a NATS channel subj is the channel to subscribe on queueName, if specified joins the queue so each message is only received by one running container all containers subscribed to a specified subj receive the message unless in a queueName, then only one in each queueName receives the message nats.Msg has the subj in it, so we can do routing from there


This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL