Refactor Oc-Sheduler
This commit is contained in:
23
infrastructure/nats/nats.go
Normal file
23
infrastructure/nats/nats.go
Normal file
@@ -0,0 +1,23 @@
|
||||
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,
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user