Class BatchController

java.lang.Object
com.espacogeek.geek.controllers.BatchController

@Controller @RestController @RequestMapping("/api/v1/batch") public class BatchController extends Object
  • Constructor Details

    • BatchController

      public BatchController()
  • Method Details

    • startJob

      @PostMapping("/start") @PreAuthorize("hasRole(\'admin\')") public org.springframework.http.ResponseEntity<String> startJob(@RequestBody(required=false) Map<String,String> body, @RequestParam(name="jobName",required=false) String jobName)
      Start a batch job by name. Accepts a JSON body with a jobName field, or falls back to a jobName request parameter when no body is provided.
      Parameters:
      body - Optional JSON body containing jobName.
      jobName - Optional request parameter fallback (used only when body is absent).
      Returns:
      HTTP 200 with the new execution ID, or an appropriate error status.
    • stopJob

      @PostMapping("/{id}/stop") @PreAuthorize("hasRole(\'admin\')") public org.springframework.http.ResponseEntity<String> stopJob(@PathVariable Long id)
      Gracefully stop a running job execution by ID.
      Parameters:
      id - The job execution ID.
      Returns:
      HTTP 200 on success, 404 if not found, or 500 on error.
    • abandonJob

      @PostMapping("/{id}/abandon") @PreAuthorize("hasRole(\'admin\')") public org.springframework.http.ResponseEntity<String> abandonJob(@PathVariable Long id)
      Force abandon a stopped or failed job execution by ID.
      Parameters:
      id - The job execution ID.
      Returns:
      HTTP 200 on success, 404 if not found, or 500 on error.
    • restartJob

      @PostMapping("/{id}/restart") @PreAuthorize("hasRole(\'admin\')") public org.springframework.http.ResponseEntity<String> restartJob(@PathVariable Long id)
      Restart a failed or stopped job execution by ID.
      Parameters:
      id - The job execution ID.
      Returns:
      HTTP 200 with the new execution ID, 404 if not found, 400 if already complete, or 500 on error.