JBoss Community

Re: Jump to end state from Node

created by Martin Weiler in jBPM Development - View the full discussion

Using token.setNode(..) should work, what exactly did not work 'as expected'?

 

 

I would, however, not recommend to use it because of the following two caveats:

  • the process execution logging becomes inconsistent, which might be relevant if audit data of the executed process instances needs to be captured
  • it is not visually clear just from looking at the process that the process execution can 'jump' at certain points.

 

A different approach for your requirement would be to introduce super-states. This concept is basically just a group over several nodes, but with the added benefit that you can add additional outgoing transitions from the super-state. These can be called from any node inside the super-state.

 

 

1. FastForward w/o super-state:

 

start -> node1 -> node2 -> node3 -> node4 -> end

 

With this process definition, if you want to move from node1 directly to node4, you could only use Token.setNode() with the above mentioned caveats.

 

2. FastForward w/ super-state:

 

           ___super-state1___
          |                  |
start  -> | node1 -> node2 ->| node3
          |__________________|   |
                   |             v  
                   `---------> node4 -> end

 

Here, you can just call the leaving transition of the super-state to node4 from any of the nodes within the super-states. This has the advantage that the logs are created properly, thus it does not break auditing, and that additional events are triggered, which could be used to set/re-set any data or variables.

 

 

HTH,

Martin

Reply to this message by going to Community

Start a new discussion in jBPM Development at Community