Iterator Example

The following diagram illustrates a simple example where an Iterator object is used in a process flow.

The message reaching the iterator is operated upon accordingly (in this, case simply duplicated) and then sent into the process flow, which performs some operation. Any Service objects can be used in the loop, including iteration. When the message is handled by the subflow, it is passed to another service, which serves as the bottom of the loop. In general, any service can be the loop bottom, although a common idiom is to use a Move service. The OnComplete or the OnSuccess relation should be used between the end of a loop (Loop back) and the next service. The process flow interpreter looks for these edges to route the end of the iteration message.

Upon reaching the end of the iteration, control is passed to the Do More service object and then to the End object of the process flow.

The iterator in this example is configured for the number of iterations and has instructions on what to pass to the end of the loop. While the iterator-specific configuration will vary, a common configuration property for iterators is the Output Document property.

The Output Document property instructs the iterator on what to pass to the end of loop. In this example, it is a Service object called Do More. While some iterators offer additional values for the Output Document property, commonly available to all iterators is the Original and Status values.

The status document has a structure, as shown in the following image.

Configuration of the iterator is performed at the start of a loop (when a message arrives at the iterator). It is not reconfigured during the loop. In this example, a count might come from an XPath into the arriving message. However, regardless of how that message changes, the count obtained at the start of the loop will be honored.


iWay Software