PHP Class ezcWorkflowNodeDiscriminator, Workflow

The Discriminator workflow pattern can be applied when the assumption made for the Simple Merge workflow pattern does not hold. It can deal with merge situations where multiple incoming branches may run in parallel. It activates its outgoing node after being activated by the first incoming branch and then waits for all remaining branches to complete before it resets itself. After the reset the Discriminator can be triggered again. Use Case Example: To improve response time, an action is delegated to several distributed servers. The first response proceeds the flow, the other responses are ignored. Incoming nodes: 2..* Outgoing nodes: 1 This example creates a workflow that splits in two parallel threads which are joined again using a ezcWorkflowNodeDiscriminator. startNode->addOutNode( $split ); $nodeExec1 = ....; // create nodes for the first thread of execution here.. $nodeExec2 = ....; // create nodes for the second thread of execution here.. $disc = new ezcWorkflowNodeDiscriminator(); $disc->addInNode( $nodeExec1 ); $disc->addInNode( $nodeExec2 ); $disc->addOutNode( $workflow->endNode ); ?>
Inheritance: extends ezcWorkflowNodeMerge
Afficher le fichier Open project: zetacomponents/workflow Class Usage Examples

Méthodes publiques

Méthode Description
activate ( ezcWorkflowExecution $execution, ezcWorkflowNode $activatedFrom = null, integer $threadId ) Activate this node.
execute ( ezcWorkflowExecution $execution ) : boolean Executes this node.

Method Details

activate() public méthode

Activate this node.
public activate ( ezcWorkflowExecution $execution, ezcWorkflowNode $activatedFrom = null, integer $threadId )
$execution ezcWorkflowExecution
$activatedFrom ezcWorkflowNode
$threadId integer

execute() public méthode

Executes this node.
public execute ( ezcWorkflowExecution $execution ) : boolean
$execution ezcWorkflowExecution
Résultat boolean true when the node finished execution, and false otherwise