@ApiOperation(value = "Get a single timer job", tags = {"Jobs"}) @ApiResponses(value = { @ApiResponse(code = 200, message = "Indicates the timer job exists and is returned."), @ApiResponse(code = 404, message = "Indicates the requested job does not exist.") }) @RequestMapping(value = "/management/timer-jobs/{jobId}", method = RequestMethod.GET, produces = "application/json") public JobResponse getTimerJob(@ApiParam(name = "jobId") @PathVariable String jobId, HttpServletRequest request) { Job job = managementService.createTimerJobQuery().jobId(jobId).singleResult(); if (job == null) { throw new ActivitiObjectNotFoundException("Could not find a timer job with id '" + jobId + "'.", Job.class); } return restResponseFactory.createJobResponse(job); }
@ApiOperation(value = "Get the exception stacktrace for a timer job", tags = {"Jobs"}) @ApiResponses(value = { @ApiResponse(code = 200, message = "Indicates the requested job was not found and the stacktrace has been returned. The response contains the raw stacktrace and always has a Content-type of text/plain."), @ApiResponse(code = 404, message = "Indicates the requested job was not found or the job doesn’t have an exception stacktrace. Status-description contains additional information about the error.") }) @RequestMapping(value = "/management/timer-jobs/{jobId}/exception-stacktrace", method = RequestMethod.GET) public String getTimerJobStacktrace(@ApiParam(name = "jobId") @PathVariable String jobId, HttpServletResponse response) { Job job = managementService.createTimerJobQuery().jobId(jobId).singleResult(); if (job == null) { throw new ActivitiObjectNotFoundException("Could not find a job with id '" + jobId + "'.", Job.class); } String stackTrace = managementService.getTimerJobExceptionStacktrace(job.getId()); if (stackTrace == null) { throw new ActivitiObjectNotFoundException("Timer job with id '" + job.getId() + "' doesn't have an exception stacktrace.", String.class); } response.setContentType("text/plain"); return stackTrace; }