Files
2026-03-25 11:11:37 +01:00

24 lines
889 B
Go

package nats
import (
"oc-scheduler/infrastructure/execution"
"oc-scheduler/infrastructure/planner"
"cloud.o-forge.io/core/oc-lib/tools"
)
// ListenNATS registers all NATS event handlers and starts listening.
// Each handler is a thin router that delegates to the appropriate service.
func ListenNATS() {
tools.NewNATSCaller().ListenNats(map[tools.NATSMethod]func(tools.NATSResponse){
tools.PLANNER_EXECUTION: planner.GetPlannerService().HandleStore,
tools.CONSIDERS_EVENT: handleConsidersEvent,
tools.REMOVE_RESOURCE: handleRemoveResource,
tools.CREATE_RESOURCE: handleCreateResource,
tools.CONFIRM_EVENT: handleConfirm,
tools.WORKFLOW_STARTED_EVENT: execution.HandleWorkflowStarted,
tools.WORKFLOW_STEP_DONE_EVENT: execution.HandleWorkflowStepDone,
tools.WORKFLOW_DONE_EVENT: execution.HandleWorkflowDone,
})
}