Class ExecutionController

java.lang.Object
ai.nervemind.app.api.ExecutionController

@RestController @RequestMapping("/api/executions") public class ExecutionController extends Object
REST API controller for workflow executions.
  • Constructor Details

    • ExecutionController

      public ExecutionController(ExecutionService executionService)
      Constructs a new ExecutionController.
      Parameters:
      executionService - the execution service to use
  • Method Details

    • findAll

      @GetMapping public List<ai.nervemind.common.dto.ExecutionDTO> findAll()
      Retrieves all workflow executions.
      Returns:
      list of all executions
    • findById

      @GetMapping("/{id}") public org.springframework.http.ResponseEntity<ai.nervemind.common.dto.ExecutionDTO> findById(@PathVariable Long id)
      Retrieves a specific workflow execution by ID.
      Parameters:
      id - the execution ID
      Returns:
      the execution if found, or 404
    • findByWorkflowId

      @GetMapping("/workflow/{workflowId}") public List<ai.nervemind.common.dto.ExecutionDTO> findByWorkflowId(@PathVariable Long workflowId)
      Retrieves all executions for a specific workflow.
      Parameters:
      workflowId - the workflow ID
      Returns:
      list of executions for the workflow
    • findRunning

      @GetMapping("/running") public List<ai.nervemind.common.dto.ExecutionDTO> findRunning()
      Retrieves all currently running workflow executions.
      Returns:
      list of currently running executions
    • executeWorkflow

      @PostMapping("/run/{workflowId}") @ResponseStatus(ACCEPTED) public CompletableFuture<ai.nervemind.common.dto.ExecutionDTO> executeWorkflow(@PathVariable Long workflowId, @RequestBody(required=false) Map<String,Object> input)
      Triggers an asynchronous workflow execution.
      Parameters:
      workflowId - the workflow to execute
      input - optional input data
      Returns:
      future with the execution result
    • executeWorkflowSync

      @PostMapping("/run/{workflowId}/sync") public ai.nervemind.common.dto.ExecutionDTO executeWorkflowSync(@PathVariable Long workflowId, @RequestBody(required=false) Map<String,Object> input)
      Triggers a synchronous workflow execution.
      Parameters:
      workflowId - the workflow to execute
      input - optional input data
      Returns:
      the execution result
    • cancel

      @PostMapping("/{id}/cancel") public org.springframework.http.ResponseEntity<Void> cancel(@PathVariable Long id)
      Cancels a running workflow execution.
      Parameters:
      id - the execution ID to cancel
      Returns:
      200 if cancelled, or 404