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
All checks were successful
ci/woodpecker/push/build-image Pipeline was successful
This commit is contained in:
@@ -69,6 +69,12 @@ sinks:
|
|||||||
driver: stdout
|
driver: stdout
|
||||||
params: {}
|
params: {}
|
||||||
|
|
||||||
|
- name: nats_weatherfeeder
|
||||||
|
driver: nats
|
||||||
|
params:
|
||||||
|
url: nats://nats:4222
|
||||||
|
exchange: weatherfeeder
|
||||||
|
|
||||||
# - name: logfile
|
# - name: logfile
|
||||||
# driver: file
|
# driver: file
|
||||||
# params:
|
# params:
|
||||||
@@ -78,5 +84,8 @@ routes:
|
|||||||
- sink: stdout
|
- sink: stdout
|
||||||
kinds: ["observation", "forecast", "alert"]
|
kinds: ["observation", "forecast", "alert"]
|
||||||
|
|
||||||
|
- sink: nats_weatherfeeder
|
||||||
|
kinds: ["observation", "forecast", "alert"]
|
||||||
|
|
||||||
# - sink: logfile
|
# - sink: logfile
|
||||||
# kinds: ["observation", "alert", "forecast"]
|
# kinds: ["observation", "alert", "forecast"]
|
||||||
|
|||||||
@@ -40,12 +40,17 @@ func main() {
|
|||||||
srcReg := fksources.NewRegistry()
|
srcReg := fksources.NewRegistry()
|
||||||
wfsources.RegisterBuiltins(srcReg)
|
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 := fksinks.NewRegistry()
|
||||||
sinkReg.Register("stdout", func(cfg config.SinkConfig) (fksinks.Sink, error) {
|
sinkReg.Register("stdout", func(cfg config.SinkConfig) (fksinks.Sink, error) {
|
||||||
return fksinks.NewStdoutSink(cfg.Name), nil
|
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 ---
|
// --- Build sources into scheduler jobs ---
|
||||||
var jobs []fkscheduler.Job
|
var jobs []fkscheduler.Job
|
||||||
for i, sc := range cfg.Sources {
|
for i, sc := range cfg.Sources {
|
||||||
|
|||||||
Reference in New Issue
Block a user