Workflow: ezcWorkflowNodeSynchronizingMerge
[ ]
[ Theoretical background ]
[ ]
[ ]
[ ]
[ ]
Class: ezcWorkflowNodeSynchronizingMerge
|
This node implements the Synchronizing Merge workflow pattern. [
source]
The Synchronizing Merge workflow pattern is to be used to synchronize multiple parallel threads of execution that are activated by a preceding Multi-Choice.
Incoming nodes: 2..* Outgoing nodes: 1
This example displays how you can use ezcWorkflowNodeMultiChoice to activate one or more branches depending on the input and how you can use a synchronizing merge to merge them together again. Execution will not contiue until all activated branches have been completed.
1. <?php
2. $workflow = new ezcWorkflow( 'Test' );
3.
4. // wait for input into the workflow variable value.
5. $input = new ezcWorkflowNodeInput( array( 'value' => new ezcWorkflowConditionIsInt ) );
6. $workflow->startNode->addOutNode( $input );
7.
8. // create the exclusive choice branching node
9. $choice = new ezcWorkflowNodeMultiChoice;
10. $input->addOutNode( $choice );
11.
12. $branch1 = ....; // create nodes for the first branch of execution here..
13. $branch2 = ....; // create nodes for the second branch of execution here..
14.
15. // add the outnodes and set the conditions on the exclusive choice
16. $choice->addConditionalOutNode( new ezcWorkflowConditionVariable( 'value',
17. new ezcWorkflowConditionGreaterThan( 1 ) ),
18. $branch1 );
19. $choice->addConditionalOutNode( new ezcWorkflowConditionVariable( 'value',
20. new ezcWorkflowConditionGreaterThan( 10 ) ),
21. $branch2 );
22.
23. // Merge the two branches together and continue execution.
24. $merge = new ezcWorkflowNodeSynchronizingMerge();
25. $merge->addInNode( $branch1 );
26. $merge->addInNode( $branch2 );
27. $merge->addOutNode( $workflow->endNode );
28. ?>
Parents
ezcWorkflowNode
|
--ezcWorkflowNodeMerge
|
--ezcWorkflowNodeSynchronization
|
--ezcWorkflowNodeSynchronizingMerge
Inherited Constants
From
ezcWorkflowNode:
Inherited Member Variables
From
ezcWorkflowNodeMerge:
From
ezcWorkflowNode:
Inherited Methods
From
ezcWorkflowNodeMerge :
From
ezcWorkflowNode :
Last updated: Mon, 21 Dec 2009