81e7223560
Text Extraction * bases * go * splitting * structure * movetoasync * movetoasync * settinguptrigger * reorder * storevent * standardisepollingvalidation * unittests * fixlint * fixlint * awscfg * generatesample * followthrough * tests * clena * store * externalidcleanup * clientid * local * baseunittests * putobjecttests * tests
51 lines
1.2 KiB
Go
51 lines
1.2 KiB
Go
// **Listens For**: S3 Event
|
|
//
|
|
// **Action**.
|
|
//
|
|
// It will identify the type of event and the location of said event, and forward the task accordingly.
|
|
//
|
|
// It supports the document initialisation and document text processing stages. Events may be pushed to the DOCINIT and DOCTEXTPROCESS queues.
|
|
package main
|
|
|
|
import (
|
|
"context"
|
|
"log/slog"
|
|
"os"
|
|
|
|
storeeventrunner "queryorchestration/api/storeEventRunner"
|
|
documentstore "queryorchestration/internal/document/store"
|
|
"queryorchestration/internal/server/runner"
|
|
"queryorchestration/internal/serviceconfig/queue/documentinit"
|
|
"queryorchestration/internal/serviceconfig/queue/documenttextprocess"
|
|
|
|
_ "github.com/lib/pq"
|
|
)
|
|
|
|
type StoreEventConfig struct {
|
|
runner.BaseConfig[storeeventrunner.S3EventNotification]
|
|
documentinit.DocInitConfig
|
|
documenttextprocess.DocTextProcessConfig
|
|
}
|
|
|
|
func main() {
|
|
ctx := context.Background()
|
|
|
|
cfg := &StoreEventConfig{}
|
|
|
|
cfg.ControllerFunc = func() runner.Controller[storeeventrunner.S3EventNotification] {
|
|
store := documentstore.New(cfg)
|
|
|
|
return storeeventrunner.New(cfg.GetValidator(), &storeeventrunner.Services{
|
|
Store: store,
|
|
})
|
|
}
|
|
|
|
server, err := runner.New(ctx, cfg)
|
|
if err != nil {
|
|
slog.Error(err.Error())
|
|
os.Exit(1)
|
|
}
|
|
|
|
server.Listen(ctx)
|
|
}
|