Developing Apama Applications > Developing Apama Applications in EPL > Defining What Happens When Matching Events Are Found > Generating events > Generating events with the route command
Generating events with the route command
The route command generates a new event that goes to the front of the input queue of the current context. Any active listeners seeking that event then receive it. There is only one difference between an externally sourced event (passed in through a live message feed) and an event that was generated internally through a route command. The difference is that internally routed events are placed at the front of the context’s input queue in the same order as they are routed within an action, and after any previously internally routed events where multiple listener actions have been triggered by an event. The correlator processes the routed events on the input queue before it processes the next non-routed event on the input queue. See Event processing order.
For example:
action simulateCrash() {
  route StockTick(currentStock.name, 50.0);
  route StockTick(currentStock.name, 30.0);
  route StockTick(currentStock.name, 20.0);
  route StockTick(currentStock.name, 10.0);
  route StockTick(currentStock.name, 5.0);
  route StockTick(currentStock.name, 1.0);
}
The simulateCrash() action shown above routes six StockTick events for the monitor’s specific stock name, with drastically reducing prices. Other monitors (or the same monitor) may receive these events and process them accordingly.
You cannot route the following types:
*action, chunk, listener, stream
*A sequence that contains a type that is unroutable
*A dictionary whose key or value is a type that is unroutable
*An event that contains a type that is unroutable
Note that you can route an event whose type is defined in a monitor.
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.