Developing Apama Applications > Developing Apama Applications in EPL > Common EPL Patterns > 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, ... );
      Response r;
      on Response(requestId=id):r {
      // continue processing
      ...
      // Beware! Any code here will execute immediately
      // (before processing the response)
   }
}
 
monitor Server {
   action processRequests() {
      Request r;
      on all Request():r {
         // evaluate response
         route Response(r.id,...);
      }
   }
}
Copyright © 2013 Software AG, Darmstadt, Germany and/or Software AG USA Inc., Reston, VA, USA, and/or Terracotta Inc., San Francisco, CA, USA, and/or Software AG (Canada) Inc., Cambridge, Ontario, Canada, and/or, Software AG (UK) Ltd., Derby, United Kingdom, and/or Software A.G. (Israel) Ltd., Or-Yehuda, Israel and/or their licensors.