0

I am using JBPM 7.59, I have made a headless process on JBPM and running it through Rest API Calls. I have a scenario here in which I got stuck in GET Rest Api Call and eventually got Read Timeout.

So, my process run smoothly and I reached to that particular point in which my JBPM process call a REST API (implemented in JAVA) to execute particular business and in that business I want some details of that running process instance, so I call below Rest service of JBPM,

GET /server/admin/containers/{containerId}/processes/instances/{processInstanceId}/nodes Returns all nodes in a specified process instance.

which obviously means it will return all nodes of specified process instance, but when I call this above service it got stuck and eventually my Rest Client throw Read time out Exception. I have set 30 seconds for Timeout but this service normally not took more than 35ms in actual case but in this scenario it got stuck, I can understand if this is the scenario for PUT or POST calls but I cannot understand why it is happening in GET call.

Can anyone please help me on this issue?

TIA

Edited:

Below is the scenario of my JBPM process, where my process stuck. So when I complete this cas Signing Confirmation Task from API call, so my next node execute which is Signing Confirmation this is basically a Custom REST API call which eventually call to a Java method.

Process of JBPM

So in that Java method I'm calling below API

GET /server/admin/containers/{containerId}/processes/instances/{processInstanceId}/nodes Returns all nodes in a specified process instance

which eventually got stuck and didn't give me any response.

Below is the java code which I'm using to call above API with (okHttp)

public static final OkHttpClient client = new OkHttpClient.Builder().connectTimeout(60, TimeUnit.SECONDS)
            .writeTimeout(60, TimeUnit.SECONDS).readTimeout(60, TimeUnit.SECONDS).build();

Request req = new Request.Builder().url("http://localhost:8090/kie-server/services/rest/server/admin/containers/Signing_1.0.0-SNAPSHOT/processes/instances/213/nodes")
.addHeader(HttpHeaders.AUTHORIZATION, "Basic d2JhZG1pbjp3YmFkbWlu")
.addHeader(HttpHeaders.ACCEPT, "application/json")
.addHeader(HttpHeaders.CONTENT_TYPE, "application/json")
.addHeader(HttpHeaders.ACCEPT_ENCODING, "gzip, deflate, br");

String response = null;
try (Response res = client.newCall(req).execute()) {
    String responseBody = res.body().string();
    if (res.isSuccessful()) {
        response = responseBody;
    } else {
        int responseCode = res.code();
    }
} catch (IOException e) {
    throw new JBPMClientException(JBPMClientException.COMMUNICATION_ERROR, e);
}
return response;

Got stuck on this line

Response res = client.newCall(req).execute()

1 Answers1

0

ReadTimeout - read time out - default to 60 seconds.

By default is 60 sec. Is there any reason to set 30 second?

Amit Nijhawan
  • 303
  • 2
  • 10
  • No there is no any reason to set this timeout but issue is still the same if I set timeout to 60 seconds. My GET call stuck and didn't response. – Fasih Ur Rehman Dec 07 '21 at 15:38
  • Check if there any node stuck or not . Please check database base table nodeinstanceimpl and processinstanceimpl(name can be slightly diff) also and please check the status of that process. – Amit Nijhawan Dec 08 '21 at 05:36
  • No, there is only one node which is running at a time and that running node is basically a REST Call which call by JBPM to JAVA, and in that REST Call method I am fetching the details of above mentioned API, and it will stuck there untill it gets timeout. The status of process remains Active. What should I exactly check in those tables ? – Fasih Ur Rehman Dec 08 '21 at 06:45
  • I tried to pass url in rest task data i/p like url " http://localhost:8080/kie-server/services/rest/server/admin/containers/ww_1.0.1-SNAPSHOT/processes/instances/3/nodes " and once I start the process from business central executes successfully , I am not sure your java code what you have implemented and if you send that code so I can try the same in my local environment. – Amit Nijhawan Dec 08 '21 at 08:55
  • I have edited my question, please check – Fasih Ur Rehman Dec 08 '21 at 10:20