... {color:#ff0033}{*}Warning{*}{color}
{color:#ff0000}{_}This, by no stretch of the imagination, is meant to control life weaponery, or even machinery for that matter... this is meant as a training exercise ONLY\!_{color}
h2. CEP Example, a Missile Launch Control
h3. Technical Complexity
Medium
h3. Purpose
* Allow the triggering of an outbound event, when receiving multiple synchronous inbound events. * Provide a sample of an CEP processing, where the interrellation of multiple events is what is of business relevance, and not a single event.
h3. Situation
We've all seen the war movies (or end of the world movies...) where you have two soldiers that have to secure the launch, and press a button at the same time for a missile launch to occur. We will take a look at how this could be done here, using IEP. * The soldiers receive the order to launch the missile ** Key A, Key B and the fire button have to be pressed at the same time (within a span of 1 second). ** As a consequence, a file is written with the fire order. * This could also be used as a mean to detect conflicting events that should not happen at the same time, or that should respect black out periods.
h3.
h3. Design
* We need capture the inbound stream, and keep the events that just occurred in the last second. ** For simplicity's sake, we will consider that only one event of each type can happen at any single second. * When the events are captured, we will do a union in the key streams, and if we have more than 1 key, we will trigger that the security criteria has been observed. * With the security criteria and the fire button pressed, we will send the order message to launch the missile.
h3. IEP Constructs Used
|
... * The inbound streams are routed through a time based window of 1 second.
* The security check is in green * All blue boxes are not necessary for the process to work. But they do provide valuable debugging information. * The authorized fire is a check that ** the count(turnedkey)>=2 and that the fire=1 * We only take new authorization to be placed in the output stream
h4.
[Sample Files|http://mediacast.sun.com/users/Serge_Blais/media/CEPSample_MissileControl|Source code, as Netbeans Projects (iep and CA)]
h3. Example Limitations
* This is a exercise only.... * The first run may not work, as the service assembly needs to be loaded, the 1 second criteria may not be met.
|