Updated main.go to register the postgres and NATS sinks in addition to the stdout sink.
All checks were successful
ci/woodpecker/push/build-image Pipeline was successful

This commit is contained in:
2026-02-07 11:57:54 -06:00
parent ffd4dfa76d
commit 9663fdfc43
2 changed files with 16 additions and 2 deletions

View File

@@ -69,6 +69,12 @@ sinks:
driver: stdout
params: {}
- name: nats_weatherfeeder
driver: nats
params:
url: nats://nats:4222
exchange: weatherfeeder
# - name: logfile
# driver: file
# params:
@@ -78,5 +84,8 @@ routes:
- sink: stdout
kinds: ["observation", "forecast", "alert"]
- sink: nats_weatherfeeder
kinds: ["observation", "forecast", "alert"]
# - sink: logfile
# kinds: ["observation", "alert", "forecast"]

View File

@@ -40,12 +40,17 @@ func main() {
srcReg := fksources.NewRegistry()
wfsources.RegisterBuiltins(srcReg)
// Minimal sink set to compile: stdout only.
// Compile stdout, Postgres, and NATS sinks for weatherfeeder. The former is useful for debugging and the latter are the main intended outputs.
sinkReg := fksinks.NewRegistry()
sinkReg.Register("stdout", func(cfg config.SinkConfig) (fksinks.Sink, error) {
return fksinks.NewStdoutSink(cfg.Name), nil
})
sinkReg.Register("postgres", func(cfg config.SinkConfig) (fksinks.Sink, error) {
return fksinks.NewPostgresSinkFromConfig(cfg)
})
sinkReg.Register("nats", func(cfg config.SinkConfig) (fksinks.Sink, error) {
return fksinks.NewNATSSinkFromConfig(cfg)
})
// --- Build sources into scheduler jobs ---
var jobs []fkscheduler.Job
for i, sc := range cfg.Sources {