// **Listens For**: Body Containing Document ID // // **Action**. // // Find the queries with no dependencies that do not have a valid result for a document. // // The reasoning for only extracting these is to start the query extraction process only for necessary queries, and the query runner will manage updating downstream dependencies. // // There are 2 situations that cause a query to show up in this list: // // The query has no required dependencies. // // All required dependencies have a valid result. // // An event with the document id is pushed to the DOCTEXT queue. package main import ( "context" "log/slog" "os" querysyncrunner "queryorchestration/api/querySyncRunner" resultsync "queryorchestration/internal/query/result/sync" querysync "queryorchestration/internal/query/sync" "queryorchestration/internal/server/runner" queryc "queryorchestration/internal/serviceconfig/queue/query" _ "github.com/lib/pq" ) type QuerySyncConfig struct { runner.BaseConfig[querysyncrunner.Body] queryc.QueryConfig } func main() { ctx := context.Background() cfg := &QuerySyncConfig{} cfg.ControllerFunc = func() runner.Controller[querysyncrunner.Body] { sync := resultsync.New(cfg) svc := querysync.New(cfg, &querysync.Services{ ResultSync: sync, }) c := querysyncrunner.New(cfg.GetValidator(), &querysyncrunner.Services{ QuerySync: svc, }) return &c } server, err := runner.New(ctx, cfg) if err != nil { slog.Error(err.Error()) os.Exit(1) } server.Listen(ctx) }