@RestController
@RequestMapping(value="${batch.web.operations.base:/batch/operations}")
public class JobOperationsController
extends Object
The base url can be set via property batch.web.operations.base, its default is /batch/operations. There are four endpoints available:
| Modifier and Type | Field and Description |
|---|---|
static String |
JOB_PARAMETERS |
| Constructor and Description |
|---|
JobOperationsController(org.springframework.batch.core.launch.JobOperator jobOperator,
org.springframework.batch.core.explore.JobExplorer jobExplorer,
org.springframework.batch.core.configuration.JobRegistry jobRegistry,
org.springframework.batch.core.repository.JobRepository jobRepository,
org.springframework.batch.core.launch.JobLauncher jobLauncher,
org.springframework.batch.core.jsr.launch.JsrJobOperator jsrJobOperator) |
| Modifier and Type | Method and Description |
|---|---|
void |
getLogFile(javax.servlet.http.HttpServletResponse response,
long executionId) |
String |
getStatus(long executionId) |
String |
handleAlreadyExists(Exception ex) |
String |
handleAlreadyRunningOrComplete(Exception ex) |
String |
handleFileNotFound(Exception ex) |
String |
handleNoBootstrapParametersCreatedByIncrementer(Exception ex) |
String |
handleNotFound(Exception ex) |
String |
handleNotRunning(Exception ex) |
String |
handleParametersInvalid(Exception ex) |
String |
launch(String jobName,
org.springframework.util.MultiValueMap<String,String> payload) |
void |
setJobLogFileNameCreator(JobLogFileNameCreator jobLogFileNameCreator) |
String |
stop(long executionId) |
public static final String JOB_PARAMETERS
public JobOperationsController(org.springframework.batch.core.launch.JobOperator jobOperator,
org.springframework.batch.core.explore.JobExplorer jobExplorer,
org.springframework.batch.core.configuration.JobRegistry jobRegistry,
org.springframework.batch.core.repository.JobRepository jobRepository,
org.springframework.batch.core.launch.JobLauncher jobLauncher,
org.springframework.batch.core.jsr.launch.JsrJobOperator jsrJobOperator)
@RequestMapping(value="/jobs/{jobName}",
method=POST)
public String launch(@PathVariable
String jobName,
@RequestParam
org.springframework.util.MultiValueMap<String,String> payload)
throws org.springframework.batch.core.launch.NoSuchJobException,
org.springframework.batch.core.JobParametersInvalidException,
org.springframework.batch.core.repository.JobExecutionAlreadyRunningException,
org.springframework.batch.core.repository.JobRestartException,
org.springframework.batch.core.repository.JobInstanceAlreadyCompleteException,
org.springframework.batch.core.launch.JobParametersNotFoundException
org.springframework.batch.core.launch.NoSuchJobExceptionorg.springframework.batch.core.JobParametersInvalidExceptionorg.springframework.batch.core.repository.JobExecutionAlreadyRunningExceptionorg.springframework.batch.core.repository.JobRestartExceptionorg.springframework.batch.core.repository.JobInstanceAlreadyCompleteExceptionorg.springframework.batch.core.launch.JobParametersNotFoundException@RequestMapping(value="/jobs/executions/{executionId}",
method=GET)
public String getStatus(@PathVariable
long executionId)
throws org.springframework.batch.core.launch.NoSuchJobExecutionException
org.springframework.batch.core.launch.NoSuchJobExecutionException@RequestMapping(value="/jobs/executions/{executionId}/log",
method=GET)
public void getLogFile(javax.servlet.http.HttpServletResponse response,
@PathVariable
long executionId)
throws org.springframework.batch.core.launch.NoSuchJobExecutionException,
IOException
org.springframework.batch.core.launch.NoSuchJobExecutionExceptionIOException@RequestMapping(value="/jobs/executions/{executionId}",
method=DELETE)
public String stop(@PathVariable
long executionId)
throws org.springframework.batch.core.launch.NoSuchJobExecutionException,
org.springframework.batch.core.launch.JobExecutionNotRunningException
org.springframework.batch.core.launch.NoSuchJobExecutionExceptionorg.springframework.batch.core.launch.JobExecutionNotRunningException@ResponseStatus(value=NOT_FOUND)
@ExceptionHandler(value={org.springframework.batch.core.launch.NoSuchJobException.class,org.springframework.batch.core.launch.NoSuchJobExecutionException.class,javax.batch.operations.JobStartException.class})
public String handleNotFound(Exception ex)
@ResponseStatus(value=NOT_FOUND) @ExceptionHandler(value=org.springframework.batch.core.launch.JobParametersNotFoundException.class) public String handleNoBootstrapParametersCreatedByIncrementer(Exception ex)
@ResponseStatus(value=CONFLICT)
@ExceptionHandler(value={org.springframework.batch.core.UnexpectedJobExecutionException.class,org.springframework.batch.core.launch.JobInstanceAlreadyExistsException.class,org.springframework.batch.core.repository.JobInstanceAlreadyCompleteException.class})
public String handleAlreadyExists(Exception ex)
@ResponseStatus(value=CONFLICT)
@ExceptionHandler(value={org.springframework.batch.core.repository.JobExecutionAlreadyRunningException.class,javax.batch.operations.JobExecutionAlreadyCompleteException.class,org.springframework.batch.core.repository.JobRestartException.class})
public String handleAlreadyRunningOrComplete(Exception ex)
@ResponseStatus(value=UNPROCESSABLE_ENTITY) @ExceptionHandler(value=org.springframework.batch.core.JobParametersInvalidException.class) public String handleParametersInvalid(Exception ex)
@ResponseStatus(value=NOT_FOUND) @ExceptionHandler(value=java.io.FileNotFoundException.class) public String handleFileNotFound(Exception ex)
@ResponseStatus(value=CONFLICT) @ExceptionHandler(value=org.springframework.batch.core.launch.JobExecutionNotRunningException.class) public String handleNotRunning(Exception ex)
@Autowired(required=false) public void setJobLogFileNameCreator(JobLogFileNameCreator jobLogFileNameCreator)
Copyright © 2016. All Rights Reserved.