Files
query-orchestration/cmd/docCleanRunner/main.go
T
Jay Brown a6e081e5cd Merged in feature/log-version (pull request #185)
inject and print version at startup for all services

* inject and print version

* coverage
2025-09-18 21:06:21 +00:00

61 lines
1.3 KiB
Go

// **Listens For**: Body Containing Document ID.
//
// **Action**.
//
// If the document is not already clean according to the collector standards, a clean is triggered.
//
// An event with the document id is pushed to the DOCTEXT queue.
package main
import (
"context"
"log/slog"
"os"
doccleanrunner "queryorchestration/api/docCleanRunner"
documentclean "queryorchestration/internal/document/clean"
"queryorchestration/internal/server/runner"
"queryorchestration/internal/serviceconfig/build"
"queryorchestration/internal/serviceconfig/objectstore"
"queryorchestration/internal/serviceconfig/queue/documenttext"
_ "github.com/lib/pq"
)
type DocCleanConfig struct {
runner.BaseConfig[doccleanrunner.Body]
documenttext.DocTextConfig
objectstore.ObjectStoreConfig
}
func main() {
// Print version information before any environment checks
build.PrintVersionInfo("docCleanRunner")
ctx := context.Background()
cfg := &DocCleanConfig{}
cfg.ControllerFunc = func() runner.Controller[doccleanrunner.Body] {
clean := documentclean.New(cfg)
return doccleanrunner.New(&doccleanrunner.Services{
Clean: clean,
})
}
server, err := runner.New(ctx, cfg)
if err != nil {
slog.Error(err.Error())
os.Exit(1)
}
err = cfg.SetStoreClient(ctx)
if err != nil {
slog.Error(err.Error())
os.Exit(1)
}
server.Listen(ctx)
}