5

So we're exploring using Drools/JBPM, and we're finding it very difficult to get data out of JBPM. I feel like we're missing something obvious.

We're kicking a JBPM process off using the RESTful interface and creating a process instance: POST /server/containers/{containerId}/processes/{processId}/instances

After the process instance is complete however, we need to retrieve the results. How do you do that? Is there something in the JBPM process we need to set (like a variable or what not)?

We've poured through a ton of examples and docs at this point and can't seem to find an answer to what should be simple.

Thank you, -Jonathan

Jonathan S. Fisher
  • 8,189
  • 6
  • 46
  • 84

1 Answers1

2

When you make a POST request to /server/containers/{containerId}/processes/{processId}/instances it will return your process instance id.

Get results from current running process:
GET /server/containers/{containerId}/processes/definitions/{processId}/variables

Get results from past running processes:
GET /server/queries/processes/instances/{processInstanceId}/variables/instances/{varName}

Go to "process instances" in workbench to make sure you are storing data

Kie Workbench

ShadyBears
  • 3,955
  • 13
  • 44
  • 66
  • Thanks!!! Is there a way to have return the process variables instead of having to retrive them after termination? (Syncronous invocation instead of async?) – Jonathan S. Fisher Jun 20 '19 at 19:36
  • Are you using this variable for another process? – ShadyBears Jun 20 '19 at 19:40
  • Quite possibly, we might call out, then need to call another ruleset. For now, we're just trying to view the data! – Jonathan S. Fisher Jun 20 '19 at 19:41
  • If you want to use it for another process, you would need to create and initialize a global variable. If you are asking to view the data.. you can use workbench in order to do so. Because you are "creating" a process instance, it is (correctly) returning the new id of the instance created when you initialize a process. – ShadyBears Jun 20 '19 at 19:49
  • Also updated answer. You will probably want to use the 2nd endpoint... you will need to provide the process instance id... The first endpoint will get the results of any process variables of any currently running processes. – ShadyBears Jun 20 '19 at 20:04