Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
23 lines (17 sloc) 325 Bytes
package main
import (
"fmt"
nats "github.com/nats-io/go-nats"
"sync"
)
const Subject = "test1"
func main() {
conn, _ := nats.Connect(nats.DefaultURL)
wg := sync.WaitGroup{}
wg.Add(1)
conn.Subscribe(Subject, func(m *nats.Msg) {
fmt.Printf("Received a message: %s\n", string(m.Data))
wg.Done()
})
wg.Wait()
}
You can’t perform that action at this time.