while loop

Conditional Loop

Version: 17.07

Supported Since: 17.07

What is a Conditional Loop processor?

Conditional loop processor can be used to execute the same flow iteratively while the specified conditions satisfies. This processor behaves similar to standard while loops which are available commonly in any programming language.

In order to use this processing element, you must first select the Flow Control dependency from the processor list when you are creating an empty Ultra project. If you have already created a project, you can add this dependency via Component Registry. From Tools menu, select Ultra Studio → Component Registry and from the Processors list, select the Flow Control dependency.

while loop ico labled

Out Ports

Loop termination out

Once the conditions are met to terminate the loop, message context will leave the loop through this port

In loop flow port

If the conditions are met to continue looping, message context will be passed through this port. The flow which starts from this port will act similar to the body of a standard for loop.

On Exception

The message context will be sent to this out port if any exception occurred while looping. However, if an exception thrown during the in loop flow, the loop will be terminated and continue through the exception flow of the corresponding element.

Design of the flow should re connect back to the Conditional Loop processor’s In Port in order to maintain the looping functionality.

Parameters

Predicate Type *

Basic

This parameter will be available if loop is configured in Runtime iteration determination mode(Fixed Counter = false).The type of predicate to be used for the evaluation. The following predicate types are supported.

  • HEADER - A transport header value from the message will be used in the predicate

  • PROPERTY - A message property will be used in the predicate

  • CONTENT - An extracted XPath value from the message payload will be used in the predicate

  • VARIABLE - A scope variable from the message context will be used in the predicate

Variable Name *

Basic

The interpretation of this parameter’s value depends on the selected predicate type.

  • HEADER - Variable Name is the name of the transport header to be used in the predicate

  • PROPERTY - Variable Name is the key of the message property to be used in the predicate

  • CONTENT - The XPath to extract the value the from message payload

  • VARIABLE - Variable Name is the key of the scope variable to be used in the predicate

Variable Type *

Basic

The type of the variables used in the predicate. One of the following types can be selected as the value of this parameter.

  • Boolean

  • Integer

  • Long

  • Float

  • Double

  • String

It must be possible to cast/convert the value resolved (using the above predicate type and the variable name) as well as the case value in each connected case element, to this specified type.

Predicate Function *

Basic

The predicate function to be used to compare the value resolved (using the above predicate type and the variable name) and the case value in each connected case element. One of the following predicate functions can be selected as the value of this parameter.

  • EQUALS - Equivalent to Java’s Object.equals() method

  • NOT_EQUALS - Negation of EQUALS

  • MATCH - Only applicable to String variable type and equivalent to Java’s String.matches() method

  • CONTAINS - Only applicable to String variable type and equivalent to Java’s String.contains() method

  • NULL - Equivalent to Java’s ==null check

  • NOT_NULL - Negation of NULL

Namespaces

Basic

If the predicate type is CONTENT (where an XPath value is used for the condition), this parameter specifies an optional map (defined as a resource) with namespace prefixes (as keys) and namespaces (as values) used within the XPath expression

Sample Use case

This use case extends from the use case in For Loop processor

In the following use case, instead of retrying for juts 3 times, application is going to retry forever until request is successfully performed.

while loop 1
while loop 2
Figure 1. Configuration of Conditional Loop processor
In this topic
In this topic
Contact Us