Configure NATS for dwingest

This commit is contained in:
Søren Rasmussen 2022-07-23 19:15:42 +02:00
parent 2a8dfe9bd9
commit 8733b1c1cf
3 changed files with 3 additions and 16 deletions

View file

@ -36,9 +36,6 @@ func mainLoop(ctx context.Context, wg *sync.WaitGroup, js nats.JetStream, config
// Controller // Controller
ctrl := controllers.NewChamberController("Chamber 1", *config) ctrl := controllers.NewChamberController("Chamber 1", *config)
// NATS
ingest := dwingest.NewDWIngest()
// Configuration reload // Configuration reload
loadConfiguration := func() { loadConfiguration := func() {
temperature.ConfigUpdate <- *config temperature.ConfigUpdate <- *config
@ -52,6 +49,9 @@ func mainLoop(ctx context.Context, wg *sync.WaitGroup, js nats.JetStream, config
loadConfiguration() loadConfiguration()
viper.WatchConfig() viper.WatchConfig()
// NATS
ingest := dwingest.NewDWIngest()
gpio, err := hw.NewGpio() gpio, err := hw.NewGpio()
if err != nil { if err != nil {
hub.CaptureException(err) hub.CaptureException(err)

View file

@ -41,18 +41,6 @@ func main() {
log.Fatal(err) log.Fatal(err)
} }
_, err = js.AddStream(&nats.StreamConfig{
Name: config.NATS.Stream,
Subjects: []string{
fmt.Sprintf("%v.*", config.NATS.Stream),
},
Replicas: 2,
Retention: nats.WorkQueuePolicy,
})
if err != nil {
log.Fatal(err)
}
// HTTP // HTTP
mux := http.NewServeMux() mux := http.NewServeMux()
srv := &http.Server{ srv := &http.Server{

View file

@ -67,7 +67,6 @@ func (p *DWIngest) Run(ctx context.Context, wg *sync.WaitGroup, js nats.JetStrea
return return
} }
} }
} }