-
Notifications
You must be signed in to change notification settings - Fork 0
BPMN Choreography Diagram Support
The Corda Adapter supports multiple BPMN Choreography Diagram Elements:
To know what the current execution state of the BPMN Choreography Diagram is, the state is encoded in a string called stateEnum. It consists of multiple comma seperated numbers, e.g. 3,4. Every number encodes one task in the Process Choreography. New numbers are added when a parallel gateway splits the execution into multiple paths. To keep track, which path has already been taken, the root task number is enhanced. By using an underscore the numbers of already taken paths are added, e.g. 3_4_5, 4, 5.
The start event in Corda is represented by the init task. It invokes the instantiation of a Corda contract and defines the corresponding participants. It is encoded by the number 0. The end event is not specially handled by the system. When the task before this event is executed the system consideres the end event reached.
A task is in Corda represented by a number. The number is created by iterating over the tasks in the BPMN file and giving them a number starting at 1, because the start event has the 0. Each task has its own flow to invoke state changes.
The system handles parallel gateways by determine which task can be executed. After an opening one, every following task can be executed exactly once. This is represented by the state. Every time a task after the gateway is executed, the state is modified to store the information that the task was executed and also that the path was taken. The second information is used to prevent double execution of the path. For closing parallel gateways, it is required that every task before the gateway has been executed before the task after the gateway can be executed. Therefore it just checks the state, if it contains all the indicies of the prequel tasks.
This gateway is handles by determine the prequel task. If it is stored in the state, the system allows the execution of one of the sequel tasks. If one gets executed, the index is simply overwirtten with the new one. For closing gateways the system checks if either one of the prequel tasks had been executed to allow the execution of the sequel and overwrites the index with the sequel.
These gateways are handled equally like exclusive gateways.
The system currently does not support subchoreographies or call choreographies. The system also does not handle parallel gateways inside a loop. The state would store that every path already had been take once and therefore prevents the execution from happening in the next iteration. The system also uses the id of the BPMN to identify all deployed distributed ledgers. This requires for every request to also send the id with it.