common: rabbit refactor

Generalize interface to allow processing of any events, not just
Gitea events.
This commit is contained in:
2025-07-21 22:30:04 +02:00
parent 69dac4ec31
commit 3d24dce5c0
11 changed files with 260 additions and 151 deletions

View File

@@ -162,9 +162,9 @@ func main() {
checker := CreateDefaultStateChecker(*checkOnStart, req, Gitea, time.Duration(*checkIntervalHours)*time.Hour)
go checker.ConsistencyCheckProcess()
listenDefs := common.ListenDefinitions{
listenDefs := &common.RabbitMQGiteaEventsProcessor{
Orgs: orgs,
GitAuthor: GitAuthor,
// GitAuthor: GitAuthor,
Handlers: map[string]common.RequestProcessor{
common.RequestType_PR: req,
common.RequestType_PRSync: req,
@@ -172,7 +172,7 @@ func main() {
common.RequestType_PRReviewRejected: req,
},
}
listenDefs.RabbitURL, _ = url.Parse(*rabbitUrl)
listenDefs.Connection().RabbitURL, _ = url.Parse(*rabbitUrl)
common.PanicOnError(listenDefs.ProcessRabbitMQEvents())
common.PanicOnError(common.ProcessRabbitMQEvents(listenDefs))
}