优化结构

This commit is contained in:
Yvan
2026-08-22 10:49:48 +08:00
parent 2b78b195c1
commit 54f76bd913
11 changed files with 501 additions and 98 deletions
+6 -2
View File
@@ -7,6 +7,7 @@ import (
systemrouter "kra/internal/server/router"
systemworker "kra/internal/worker"
"kra/pkg/module"
"kra/pkg/mq"
platformtask "kra/pkg/task"
)
@@ -27,7 +28,10 @@ func TaskRegistry(catalog module.Catalog) *platformtask.Registry {
}
// Runtime composes HTTP route contributors from the enabled modules.
func Runtime(systemRoutes *systemrouter.Routes, systemTasks *systemworker.TaskMethods, registry *platformtask.Registry) *module.Runtime {
func Runtime(systemRoutes *systemrouter.Routes, systemTasks *systemworker.TaskMethods, registry *platformtask.Registry, catalog module.Catalog, subscriptions mq.SubscriptionRegistrar) (*module.Runtime, error) {
platformtask.Apply(registry, systemTasks)
return module.NewRuntime(systemRoutes)
if err := mq.ApplySubscriptions(subscriptions, catalog.SubscriptionContributors()...); err != nil {
return nil, err
}
return module.NewRuntime(systemRoutes), nil
}