Getting all variables from an active process instances

Hello,

I got a problem with a business process I’m modelling right now and don’t know how to effecient solve it. Because of the complexity and internal information I’ll use a simplified process description:

Right now we have a process for ordered pizza. Within the process instances are all information regarding the ordered pizza itself (mainly the pizza type e.g.: Salami, Hawai, Magaritta…). We have many pizza orders during the lunchtime and got around 500 orders going. The management got in touch with me and asked me if I can extend our dashboard (external webfrontend) with statistics of currently opened orders.

For getting the data my solution would be using the REST endpoints like this:

  • GET all process instances of the process
  • foreach process instance GET the pizza type variable and display it

Right now my only concern is the performance of this. What happens if we got more process instances going? Is it best practice to do it like this or do I miss an rest endpoint, I could use instead to get all process variables more effeicient?

Hi @pugnaciousTurtle,

it depends, on what do you mean by “statistics”, but here are some thoughts from my side:

  1. take a look at this REST endpoints: https://docs.camunda.org/manual/7.9/reference/rest/variable-instance/
  2. if you have limited number of pizza types and you know all possible values of “pizza type” variable, you could iterate over these values and list process instances with corresponding pizza type (or call Get List Count request if you need only number of instances)
  3. if pizza type is immutable within one process instance, when starting the process instances, you can include pizza type in business key and then search by businessKey like ‘pizzaType%’
  4. If you need to show the list of process instances with variable value - you should consider paginating it (obvious, but still)
  5. you can go even further and check out these docs and consider using native queries or custom queries: https://docs.camunda.org/manual/7.9/user-guide/process-engine/process-engine-api/#native-queries and https://blog.camunda.com/post/2017/12/custom-queries/

If you’re more precise about what kind of statistics do you need, may be somebody has more insights

Svetlana