pamelin / go-nats-parallel

Utils for trigger NATS handlers in the separate goroutines

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

go-nats-parallel

Utils library for go-nats.

This library provides a bunch of helper subscribe functions which will invoke nats handlers in the separate goroutines.

Use this library if you require parallel processing of the incoming messages in the non-blocking fashion.

Basic Usage

ec, _ := natsll.NewEncodedJsonConn(nats.DefaultURL)
defer nc.Close()


natsll.SubscribeEc(ec, "foo", func(s string){
    fmt.Printf("Received a message: %s\n", s)
    time.Sleep(5 * time.Second) // let's dance
})

ec.Publish("foo", "Hello World")
ec.Publish("foo", "Hello World")
ec.Publish("foo", "Hello World")

About

Utils for trigger NATS handlers in the separate goroutines

License:Apache License 2.0


Languages

Language:Go 100.0%