// **Listens For**: Body Containing Document ID and Query ID // // **Action**. // // Run the query for the given document and store the result. // // Events with the document id and downstream query ids are pushed to the QUERY queue. package main import ( "context" "log/slog" "os" queryrunner "queryorchestration/api/queryRunner" "queryorchestration/internal/query" "queryorchestration/internal/query/result" resultset "queryorchestration/internal/query/result/set" resultsync "queryorchestration/internal/query/result/sync" "queryorchestration/internal/server/runner" queryc "queryorchestration/internal/serviceconfig/queue/query" _ "github.com/lib/pq" ) type QueryConfig struct { runner.BaseConfig[queryrunner.Body] queryc.QueryConfig } func main() { ctx := context.Background() cfg := &QueryConfig{} cfg.ControllerFunc = func() runner.Controller[queryrunner.Body] { que := query.New(cfg) res := result.New(cfg, &result.Services{ Query: que, }) sync := resultsync.New(cfg) resset := resultset.New(cfg, &resultset.Services{ Result: res, Query: que, Sync: sync, }) c := queryrunner.New(&queryrunner.Services{ ResultSet: resset, }) return &c } server, err := runner.New(ctx, cfg) if err != nil { slog.Error(err.Error()) os.Exit(1) } server.Listen(ctx) }