Package com.espacogeek.geek.controllers
Class BatchController
java.lang.Object
com.espacogeek.geek.controllers.BatchController
@Controller
@RestController
@RequestMapping("/api/v1/batch")
public class BatchController
extends Object
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.http.ResponseEntity<String> abandonJob(Long id) Force abandon a stopped or failed job execution by ID.org.springframework.http.ResponseEntity<String> restartJob(Long id) Restart a failed or stopped job execution by ID.org.springframework.http.ResponseEntity<String> Start a batch job by name.org.springframework.http.ResponseEntity<String> Gracefully stop a running job execution by ID.
-
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 ajobNamefield, or falls back to ajobNamerequest parameter when no body is provided.- Parameters:
body- Optional JSON body containingjobName.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.
-