programing languages

validation processor

Multi-Condition Evaluator

Version: 17.07

Supported Since: 17.07

What is Multi-Condition Evaluator?

Multi-Condition Evaluator Processing element can be used to make decisions based on pre-specified conditions. The behaviour of this element is analogous to the IF-THEN / ELSE conditional statement in high level programing languages. This is an extended version of the Conditions Evaluator

validation processor ports

Out Ports

If-Then Output

The message will be emitted from this outport if the expression specified in the element evaluates to true

Else Output

The message will be emitted from this outport if the expression specified in the element evaluates to false

On Exception

The message will be sent to this outport if any exception occurred while processing

Parameters

Expression *

Basic

This is the basic expression, which is evaluated by the processing element.
A sample expression would be
(*String$H.sample_header_name$equals$value1*) AND …​
Each expression consists of five main parts, and they are seperated by '$' character

  1. Variable Type * + 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 should be able to cast/convert the value resolved (using the above predicate type and the variable name) to this specified type.
  1. Predicate Type * + The type of predicate to be used for the evaluation. The following predicate types are supported. In the expression this will be represented by the first chatacter of the predcate type.

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

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

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

  2. Variable Name * + 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

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

  3. Predicate Function * + 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.

    • EQUALS - Equivalent to Java’s Object.equals() method. Resolved to true if the value resolved is equal to the matching value

    • MATCH - Only applicable to String variable type and equivalent to Java’s String.matches() method Resolved to true if the value resolved matches to the matching value

    • CONTAINS - Only applicable to String variable type and equivalent to Java’s String.contains() method Resolved to true if the value resolved contains the matching value

    • NULL - Resolve to true if the value resolved is null and false otherwise

    • NOT_NULL - Resolve to false if the value resolved is null and true otherwise

    • EXISTS - Resolved to true if the specified Variable Name exists, regardless of its value

  4. Matching value + Only to be used when the Predicate Function is EQUALS, MATCH or CONTAINS

A single condition can be written using above parameters, and any number or conditions can be combined using AND or OR

Sample Use Case

In the following use case, a Multi-Condition Evaluator is used to check a transport header and a scope variable in the message recieved from an HTTP Client. If the transport header is LEGACY and the scope variable AGE is 25 then the message will be sent to a particular HTTP backend and if the whole condition is not satisfied, the message will be sent to another HTTP backend.

As shown in the below diagram, let’s build our basic flow.

validatioon processor 1

As for the properties of the Conditions evaluator, specify the expression as

(*String$H.MSG_ROUTING$equals$LEGACY*) AND (*Integer$V.AGE$equals$25*)

Now if you run the project and send a message with HTTP Transport header MSG_ROUTING with value LEGACY and the scope variable AGE with value 25, that message will be sent via Egress Connector (a) and for any other message which does not satisfy the given expression, the message will be sent via Egress Connector (b)

In this topic
In this topic
Contact Us