cancel
Showing results for 
Search instead for 
Did you mean: 

Tracking execution tokens and transitions

danosaur
Champ in-the-making
Champ in-the-making
Hi,

I am currently working on the use case where I need to retreive process variables based on information about previously executed activities. I want to retreive only those process variables that have been changed by "previous" activities in the control flow but not those which were created/changed by activities in parallel control flows. I tried to put execution listeners on transitions, but the problem is that I could not find a way to retreive information from Activiti about which execution will be used to take the outgoing transition. The code snippet from the ExecutionImpl shows that this information is never made available.


      // first create the concurrent executions
      while (!transitions.isEmpty()) {
        PvmTransition outgoingTransition = transitions.remove(0);

        ExecutionImpl outgoingExecution = null;
        if (recyclableExecutions.isEmpty()) {
          outgoingExecution = concurrentRoot.createExecution();
          log.fine("new "+outgoingExecution+" created to take transition "+outgoingTransition);
        } else {
          outgoingExecution = (ExecutionImpl) recyclableExecutions.remove(0);
          log.fine("recycled "+outgoingExecution+" to take transition "+outgoingTransition);
        }
       
        outgoingExecution.setActive(true);
        outgoingExecution.setScope(false);
        outgoingExecution.setConcurrent(true);
        outgoingExecutions.add(new OutgoingExecution(outgoingExecution, outgoingTransition, true));
      }

      // prune the executions that are not recycled
      for (ActivityExecution prunedExecution: recyclableExecutions) {
        log.fine("pruning execution "+prunedExecution);
        prunedExecution.end();
      }

      // then launch all the concurrent executions
      for (OutgoingExecution outgoingExecution: outgoingExecutions) {
        outgoingExecution.take();
      }
‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

So my question: is there any way to track back execution transitions to get a path/trace of the execution token?
2 REPLIES 2

jbarrez
Star Contributor
Star Contributor
I would opt for using the History queries for that purpose.

danosaur
Champ in-the-making
Champ in-the-making
Joram,

thanks for the prompt reply. Can you please point me a way to do this using history queries? I have set the history level to full, but looking at the act_hi_* tables I can not figure out how execution tree can be restored from history since entries in these tables do not store information about transitions and execution hierarchy.