...
Flowchart |
---|
main [label="Order:main_order",fillcolor="green"] generate [label="generate",fillcolor="lightskyblue"] add [label="Order:main_order_add-order",fillcolor="green"] wait [label="wait",fillcolor="lightskyblue"] 150 [label="150",fillcolor="lightskyblue"] 160 [label="160",fillcolor="lightskyblue"] join [label="join",fillcolor="lightskyblue"] 200 [label="200",fillcolor="lightskyblue"] success [label="success",fillcolor="orange"] main -> generate generate -> wait wait -> 150 150 -> join add -> 150160 150160 -> join join -> 200 200 -> success |
...
Note that some of the elements in this example have been given particular functions to demonstrate the functioning of the Join Job and are not required for its operation in "normal" use.
An A Parent Order (in this example main_order) is started with a parameter (required_orders). This
- The required_orders parameter is read immediately by the join Job, which will then wait until the number of Orders specified in the parameter (here it is 12) have been processed.
- Note that the join Job only counts orders that have the state of the join Job as their end state
...
- (here join).
- The main_order moves to the generate_orders Job, which generates a total of 10 Child Orders.
- This number is specified in a second parameter for the main_order - generate_orders.
- 5 of these child orders start processing at node 150 and end at the join Job and 5 start at node 160 - that is, they take the other branch - and end at the join Job.
- All these Child Orders will be counted towards the required_orders parameter.
- The main_order itself then moves to the wait Job where it waits for a time specified in the Order's wait_time parameter (here 35 seconds).
- The sole purpose of this delay is to demonstrate that the main_order can reach the join Job after the other Orders.
- This delay is not necessary for the functioning of the join Job and the example will work with the wait_time parameter set to its minimum value of 1 (0 will cause an error).
- When the main_order reaches the join Job it will be counted towards the number of Orders specified in the required_orders parameter, making a total of 11 after all the generated Child Orders have been completed.
- Note that the main_order is the only Order that will be counted that does not have to have the state of the join Job as its end state.
- The main_order will now be suspended at the join Job (without the Job being processed) until:
- a further Order that has the state of the join Job as its end state is completed.
The main_order_add-order Order can now be used to increase the the total number of Orders counted by the join Job.
- In the current example running the main_order_add-order Order will case the number of Orders counted to reach the value set in the required_orders parameter.
- The join Job will now process the Order which will then proceed along the Job Chain - in this example to the Job C with the state 200.
The Job Chain, Jobs and Orders
...