Files
query-orchestration/cmd/queryRunner/main.go
T
Michael McGuinness fee71e7740 Merged in feature/postprocessing (pull request #114)
Feature/postprocessing

* tests

* passtest

* fixshorttests

* mosttests

* improvingbasedockerfile

* testspeeds

* testing

* host

* canparallel

* clean

* passfullsuite

* singlepagemax

* test

* findfeatures

* findstables

* tbls

* tablestoo

* tablestoo

* lateraltests

* tableloc

* cleanup

* inlinetable

* childids

* cleanup

* tests
2025-04-22 14:40:16 +00:00

63 lines
1.3 KiB
Go

// **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)
}