Zeta Components - high quality PHP components

Zeta Components Manual :: Docs For Class ezcWorkflowNodeDiscriminator

Workflow::ezcWorkflowNodeDiscriminator

Class ezcWorkflowNodeDiscriminator

This node implements the Discriminator workflow pattern.

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.

  1.  <?php
  2.  $workflow = new ezcWorkflow( 'Test' );
  3.  
  4.  $split = new ezcWorkflowNodeParallelSplit();
  5.  $workflow->startNode->addOutNode( $split );
  6.  $nodeExec1 = ....; // create nodes for the first thread of execution here..
  7.  $nodeExec2 = ....; // create nodes for the second thread of execution here..
  8.  
  9.  $disc = new ezcWorkflowNodeDiscriminator();
  10.  $disc->addInNode( $nodeExec1 );
  11.  $disc->addInNode( $nodeExec2 );
  12.  $disc->addOutNode( $workflow->endNode );
  13.  ?>

Source for this file: /Workflow/src/nodes/control_flow/discriminator.php

ezcWorkflowNode
   |
   --ezcWorkflowNodeMerge
      |
      --ezcWorkflowNodeDiscriminator
Version:   //autogen//

Inherited Constants

From ezcWorkflowNode:
ezcWorkflowNode::WAITING_FOR_ACTIVATION    The node is waiting to be activated.
ezcWorkflowNode::WAITING_FOR_EXECUTION    The node is activated and waiting to be executed.

Inherited Member Variables

From ezcWorkflowNodeMerge
protected ezcWorkflowNodeMerge::$maxInNodes
protected ezcWorkflowNodeMerge::$minInNodes
protected ezcWorkflowNodeMerge::$state
From ezcWorkflowNode
protected ezcWorkflowNode::$activatedFrom
protected ezcWorkflowNode::$activationState
protected ezcWorkflowNode::$configuration
protected ezcWorkflowNode::$id
protected ezcWorkflowNode::$inNodes
protected ezcWorkflowNode::$internalCall
protected ezcWorkflowNode::$maxOutNodes
protected ezcWorkflowNode::$minOutNodes
protected ezcWorkflowNode::$numInNodes
protected ezcWorkflowNode::$numOutNodes
protected ezcWorkflowNode::$outNodes
protected ezcWorkflowNode::$threadId

Inherited Methods

From ezcWorkflowNodeMerge
protected boolean ezcWorkflowNodeMerge::doMerge()
Performs the merge by ending the incoming threads and activating the outgoing node.
protected void ezcWorkflowNodeMerge::prepareActivate()
Prepares this node for activation.
From ezcWorkflowNode
public ezcWorkflowNode ezcWorkflowNode::__construct()
Constructs a new node with the configuration $configuration.
public void ezcWorkflowNode::accept()
Reimplementation of accept() calls accept on all out nodes.
protected void ezcWorkflowNode::activateNode()
Convenience method for activating an (outgoing) node.
public ezcWorkflowNode ezcWorkflowNode::addInNode()
Adds a node to the incoming nodes of this node.
public ezcWorkflowNode ezcWorkflowNode::addOutNode()
Adds a node to the outgoing nodes of this node.
public mixed ezcWorkflowNode::getConfiguration()
Returns the configuration of this node.
public ezcWorkflowNode[] ezcWorkflowNode::getInNodes()
Returns the incoming nodes of this node.
public ezcWorkflowNode[] ezcWorkflowNode::getOutNodes()
Returns the outgoing nodes of this node.
public boolean ezcWorkflowNode::removeInNode()
Removes a node from the incoming nodes of this node.
public boolean ezcWorkflowNode::removeOutNode()
Removes a node from the outgoing nodes of this node.
public void ezcWorkflowNode::verify()
Checks this node's constraints.
Documentation generated by phpDocumentor 1.4.3