-
-
Notifications
You must be signed in to change notification settings - Fork 49
Scale out using nats
This section explains aspects of setting up a Nats server for scaling out.
- Download & Run Nats from https://nats-io.github.io/docs/nats_server/installation.html
- In the Go import statements add
github.com/kataras/neffos/stackexchange/nats
and use it.
The first and only required input argument is the URL connection string of the nats server(s). Servers addresses are separated by comma ,
. If it's empty then it defaults to "nats://127.0.0.1:4222"
.
The second one is optional and can be used to register various nats client options, such as authentication, see the available nats.go options.
The nats StackExchange's client configuration defaults to nats.go DefaultOptions.
import "github.com/kataras/neffos/stackexchange/nats"
// [server := neffos.New...]
exc, err := nats.NewStackExchange(":4222")
if err != nil {
// [...]
}
server.UseStackExchange(exc)
If you use the same nats server instance for multiple neffos apps, set its exc.SubjectPrefix
to different values across your apps.
Home | About | Project | Getting Started | Technical Docs | Copyright © 2019-2023 Gerasimos Maropoulos. Documentation terms of use.