mirror of
https://github.com/SourceFellows/gobuch.git
synced 2025-07-20 07:02:53 +02:00
initial import
This commit is contained in:
19
microservices/nats/sender/cmd/main.go
Normal file
19
microservices/nats/sender/cmd/main.go
Normal file
@ -0,0 +1,19 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"log"
|
||||
|
||||
"github.com/nats-io/nats.go"
|
||||
)
|
||||
|
||||
func main() {
|
||||
nc, err := nats.Connect(nats.DefaultURL)
|
||||
|
||||
if err != nil {
|
||||
log.Fatalf("Could not connect to server because of %v", err)
|
||||
}
|
||||
defer nc.Close()
|
||||
|
||||
nc.Publish("foo", []byte("Hello World"))
|
||||
|
||||
}
|
Reference in New Issue
Block a user