test-bpmn-6.bpmn (7.8 KB)
The bpmn is very usual one, nothing interesting happenning here, in the task “ingest” , after ingesting the files, i call the following method that i have written:
public static void suspendProcessInstance(String processInstanceId, boolean isSuspend) throws Exception {
try {
HttpClient httpclient = HttpClientBuilder.create().build();
String uri = "http://localhost:8080/engine-rest/process-instance/" + processInstanceId + "/suspended";
//String uri = "http://localhost:8080/engine-rest/process-instance/"+suspended";
HttpPut httpPut = new HttpPut(uri);
JSONObject requestJson = new JSONObject();
requestJson.put("suspended", isSuspend);
StringEntity entity = new StringEntity(requestJson.toJSONString());
httpPut.setEntity(entity);
httpPut.addHeader("content-type", "application/json");
HttpResponse response = httpclient.execute(httpPut);
if (response != null) {
if (response.getStatusLine().getStatusCode() != 204) {
throw new Exception(EntityUtils.toString(response.getEntity(), "UTF-8"));
}
}
}catch(Exception e) {
logger.error(e.getMessage());
throw e;
}
}