Apama 10.3.1 | Apama Documentation | Developing Apama Applications | Developing Apama Applications in EPL | Common EPL Patterns in Monitors | Inline request-response pattern | Routing events for request-response behavior
 
Routing events for request-response behavior
The events:
event Request { integer requestId; ... }
event Response { integer requestId; ... }
The monitors:
monitor Client {
   action doWork() {
      //do some processing
      ...
      integer id := integer.getUnique();
      route Request(id, ... );
      on Response(requestId=id) as r {
      // continue processing
      ...
      // Beware! Any code here will execute immediately
      // (before processing the response)
   }
}
 
monitor Server {
   action processRequests() {
      on all Request() as r {
         // evaluate response
         route Response(r.id,...);
      }
   }
}

Copyright © 2013-2019 | Software AG, Darmstadt, Germany and/or Software AG USA, Inc., Reston, VA, USA, and/or its subsidiaries and/or its affiliates and/or their licensors.