Page tree
Skip to end of metadata
Go to start of metadata

Conditional Execution

The EEM execution engine provides a feature to control the execution of every single message.

 Every message can be

  • not executed at all
  • executed exactly once (default behavior)
  • repeated multiple times until a condition is fulfilled.

Typical use cases for this feature are:

  • Execute a message only if the preceeding response contains / does not contain a specific pattern.
  • Repeat a message until the response contains a specific pattern

Currently, the EEM editor does not provide UI support to use this feature. Instead, the XML mode in the EEM editor must be used to add attributes to the message that should be repeated / conditionally executed. The three attributes are:

  • repeatConditionVariable: The execution engine checks the variable. If the variable does not exist (is not defined) the message will not be executed.
  • repeatConditionValue (optional): If the variable specified via repeatConditionVariable contains the value given here, then the message is executed. Comparison is done case-insensitive.
  • repeatDelay: Optional delay in ms between repetitions

Typically these attributes are combined with a search in the same message (for repeated executions) or in a preceeding message (for conditional execution), such that the variable that is checked for the conditional execution is updated by the variable.

Note

This conditional execution only works for messages of type ServerRequest.

Example

 

<Message repeatConditionVariable="myVariable"  repeatConditionValue="mySignal" repeatDelay="100" activated="false"  id="12"  method="GET"  name="12_medium-webfont.eot"  recordedResponse="00011-0000000000cc0024-00110A54B7121ED384ABBBAC975E7F5C.dta"  recordedResponseContentType="text/plain; charset=UTF-8"  type="ServerRequest"  url="https://www.fakeurl.com/sites/all/themes/royalmail2012/fonts/medium-webfont.eot?"  version="HTTP/1.1" >

 

  • The message only be executed the first time if the variable myVariable exists and has the value "mySignal" before the message is reached in script execution.
    => That means you need do define and populate the variable in a message before! 
  • EEMRobot will repeat the message until the value is different to "mySignal"
  • => the current message itself needs to execute a function to assign a new value the variable "myVariable" which is then checked as condition for next exexution. Otherwise the message is in a permanent loop because the value stays "mySignal"
  • The loops are performed with a delay of 100 milliseconds

 

 

     

 

  

  • No labels