Apama 10.15.3 | Developing Apama Applications | Developing Apama Applications in EPL | Testing and Tuning EPL Monitors | Using event files
 
Using event files
The following example shows how to use &TIME (Clock) events to explicitly set the correlator clock. To do this, the correlator must have been started in external clocking mode (the &TIME events give errors otherwise). Times are in seconds since the midnight, Jan 1970 epoch.
#seed initial time (seconds since Jan 1970 epoch)
&TIME(1)
 
# Send in configuration of heartbeat interval to
# 5 SecondsSetHeartbeatInterval(5.0)
# Advance the clock (5.5 seconds)
&TIME(6.5)
 
# Correlator should have sent heartbeat with id 1 –
# acknowledge all is well
HeartbeatResponse(1,true)
Notice that the input event file has a lot of knowledge regarding the way in which the module will (should) respond. For example, the HeartbeatResponse event expects that the first HeartbeatRequest will have the ID of 1. There is necessarily a close coupling between the input scripts and the implementation of the module being tested. This is another reason why as much of this information should be extracted into the module's message exchange protocol and made explicit, and perhaps enforced by one or more interface intermediaries.
A single correlator context is guaranteed to generate the same output in the same order, even when EPL timers (such as on all wait()) are employed. This is a benefit of correlator determinism, and makes regression testing, even of temporal logic, possible.
Note:
The correlator's behavior can be nondeterministic when events are sent between multiple contexts, or when plug-ins are used.