Hi , I have created an api for retrying the stuck incidents using the incident id , this the the api- @RequestMapping(method = RequestMethod.POST, value = “/resolveIncident/{incidentId}”) @ApiOperation(“Retry stuck Activity”) @ApiResponses({ @ApiResponse(code = 400, message = “Bad request data”, response = Level3Response.class), @ApiResponse(code = 404, message = “Resource not found”, response = Level3Response.class), @ApiResponse(code = 409, message = “Resource not in correct state”, response = Level3Response.class), @ApiResponse(code = 500, message = “Server side error”, response = Level3Response.class) }) @Timed
public ResponseEntity resolveStuckActivityIncident(@PathVariable(value = “incidentId”) String incidentId)
throws Exception {
final boolean result = processOperations.resolveStuckActivityIncident(incidentId);
return ResponseEntity.ok(new Boolean(result));
}
now this api is calling the method -
public boolean resolveStuckActivityIncident(String incidentId) {
LOGGER.info(“Attempting to resolve incident with ID: {}”, incidentId);
try {
LOGGER.debug("Calling runtimeService.resolveIncident for incident ID: {}", incidentId);
this.runtimeService.resolveIncident(incidentId);
LOGGER.info("Successfully resolved incident with ID: {}", incidentId);
} catch (Exception ex) {
LOGGER.error("Error while resolving Camunda incident with ID: {}: {}", incidentId, ex.getMessage(), ex);
return false;
}
LOGGER.info("Exiting resolveStuckActivityIncident for incident ID: {}", incidentId);
return true;
}
When I try to the hit the api , its giving me a false return value always but when i tried resolving the incidents manually in the cockpit , its getting resolved, but this i want to do with service . please suggest how can I do this.
If you look at what the UI is doing, it is adding another retry to the external task.
It is a bit of a palava, to do, but from the incident, you can get the processInstanceId (sadly you cannot get the task id … don’t know why) and query the task by processInstanceId. Then you can use the ExternalTaskService to add 1 or more retries.
If you open the browser dev tools and look at the http calls the UI is making, you can see it is calling the an api to set the retry for that task (which was zero) to 1.
You can use the same api. You just need to get the task id.