Search code examples
jbpmbusiness-process-management

JBPM REST request is blocking document upload


I have a Java web application that triggers a JBPM process, the flow is as follows, annotated below:

JBPM process with a blocking call

  1. web app triggers JBPM process
  2. the process has an asynchronous REST request to a framework endpoint
  3. the framework generates a PDF and tries to upload the document to the process using a JBPM REST call (http://localhost/kie-server/services/rest/server/containers/upload_0.1.0/processes/instances/1/variable/validationDocument with accompanying JSON body)
  4. the process hangs and no document is uploaded back into JBPM

I've concluded that the REST call to upload the document back into JBPM is blocked by the original calling async REST call. The original JBPM REST call times out after 60 seconds, after the timeout the framework REST call to upload the document continues and successfully completes. Control should then be passed back to the original calling REST call but as it has timed out the process goes no further and the end process is never reached.

If the document upload step is omitted from the framework process then the process flows as expected, there is no blocking and the JBPM end process is reached. See the diagram below:

No blocking in this process

I have tried synchronous and async JBPM REST calls, same results. I have considered other solutions such as scheduling the upload of documents but this is not ideal and would much prefer an automated solution.

Any pointers greatly appreciated!


Solution

  • It would seem there was no way of calling an JBPM rest endpoint from a process that was initiated by JBPM, try this was futile, a blocking issue caused a timeout which broke the process.

    A workaround, rather than JBPM call the framework I had JBPM make a call back to the web app which in turn fired off another REST request in a separate thread. This resolved the blocking issue and the process was able to continue as expected!