What APIs are available in Flowable that help trace the path that a process instance has taken?
I’ve spent a fair amount of cycles tweaking and re-running tests for BPMN workflows that aren’t behaving as expected, only to find that it was a simple error like a missing
One user posted a great example here that would go a long way toward helping with that, but what APIs made that output possible?
I stumbled across the ExecutionTree class, but proper usage is a bit of a mystery, and the chain of classes that use that are undocumented and don’t seem to be intended for end users.
I always start with the history tables of Flowable. With the HistoricActivityInstanceQuery you can get a good overview of the activities that have been executed for a specific process instance for example. That provides good info for a lot of cases. Let me know if you are missing something from this HistoricActivityInstanceQuery result.
Thanks, I will give it a shot and update when I do. Thanks!
I played with this, and some of the other historic queries on
HistoryService. A couple of things I’m not able to figure out:
- How to get historic values of form properties when using
multiInstanceLoopCharacteristics (I tried
ProcessInstanceHistoryLog.getHistoricData() and got a lot of
HistoricVariableInstanceEntity values, but it only reported the last value set for a form property)
- How to get an execution tree, for process debugging purposes (as in the post linked above)
You can get historic values of form properties with the HistoricDetailQuery. If history level is set to full, it will include all variable updates, and not only single variable values.
For the execution tree you could use the ExecutionTreeUtil class with the buildExecutionTree method. This will provide you with a nested execution tree of the passed execution.
Thanks Tijs, the
HistoricDetailQuery pointer helps — I played with that, but was looking at variables rather than form properties.
This one I’m still having trouble with, because
buildExecutionTree takes an
ExecutionEntity collection, or a
DelegateExecution. I don’t know how to obtain an
ExecutionEntity at all, and a
DelegateExecution seems to be available only by explicit call of a service task, execution listener, etc. within the workflow.
You can get an Execution with RuntimeService createExecutionQuery. You can cast the Execution instance to an ExecutionEntity and call the buildExecutionTree method.