Version: 17.07
Supported Since: 17.01
Conditions Evaluator element can be used to make a decision based on pre-specified condition. The behaviour of this element is analogous to the IF-THEN / ELSE conditional statement in high level programing languages.
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. |
If-Then Output |
The message will be emitted from this outport if the condition specified in the element evaluates to |
Else Output |
The message will be emitted from this outport if the condition specified in the element evaluates to |
On Exception |
The message will be sent to this outport if any exception occurred while processing |
Predicate Type * |
Basic |
The type of predicate to be used for the evaluation. The following predicate types are supported.
|
||
Variable Name * |
Basic |
The interpretation of this parameter’s value depends on the selected predicate type.
|
||
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.
|
||
Predicate Function * |
Basic |
The predicate function to be used to compare the value resolved (using the above predicate type and the variable name). One of the following predicate functions can be selected as the value of this parameter.
|
||
Matching Value |
Basic |
Only to be used when the Predicate Function is EQUALS, MATCH or CONTAINS |
||
Namespaces |
Basic |
If the predicate type is CONTENT (where an XPath value is used for the condition), and if any custom namespaces are being used inside XPath expression, those should be defined as a map with those namespaces as keys and the corresponding namespace URIs as values. |
In the following use case, a Conditions Evaluator is used to check a transport header in the message received from an HTTP Client. If the value of the transport header is LEGACY then the message will be send a particular HTTP backend and if the the transport header is any other value, the message will be sent to another HTTP backend.
As shown in the below diagram, let’s build our basic flow.
As for the properties of the Conditions evaluator, specify the values as shown in the below image
Now if you run the project and send a message with HTTP Transport header MSG_ROUTING with value LEGACY, that message will be sent via Egress Connector (a) and for any other message with different value for the transport header MSG_ROUTING, the message will be sent via Egress Connector (b)