NATS Transport
Use NATS as the transport between services.
In code
package main
import (
"go-micro.dev/v6"
tnats "go-micro.dev/v6/transport/nats"
)
func main() {
t := tnats.NewTransport()
svc := micro.NewService("nats-transport", micro.Transport(t))
svc.Init()
svc.Run()
}
Via environment
Run your service with env vars set:
MICRO_TRANSPORT=nats MICRO_TRANSPORT_ADDRESS=nats://127.0.0.1:4222 go run main.go
Feedback
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.