Apama 10.15.1 | Developing Apama Applications | Developing Apama Applications in EPL | Defining What Happens When Matching Events Are Found | Generating events | Enqueuing to contexts
 
Enqueuing to contexts
To enqueue an event to a particular context, use the enqueue...to statement:
enqueue event_expression to context_expression;
Note: 
The enqueue...to statement is superseded by the send...to statement. The enqueue...to statement will be deprecated in a future release. Use the send...to statement instead. See Generating events with the send statement.
The result type of event_expression must be an event. It cannot be a string representation of an event. The result type of context_expression must be a context or a variable of type context. It cannot be a com.apama.Channel object that contains a context. The enqueue...to statement can operate on any values as well as events, provided that the any value is of a routable event type.
The enqueue...to statement sends the event to the context's input queue. Even if you have a single context, a call to enqueue x to context.current() is meaningful and useful.
You must create the context before you enqueue an event to the context. You cannot enqueue an event to a context that you have declared but not created. For example, the following code causes the correlator to terminate the monitor instance:
monitor m {
   context c;
   action onload()
   {
      enqueue A() to c;
   }
}
If you enqueue an event to a sequence of contexts and one of the contexts has not been created first then the correlator terminates the monitor instance. For details, see Sending an event to a particular context.
Sending an event to a sequence of contexts is non-deterministic.
All routable event types can be enqueued to contexts, including event types defined in monitors. There is a runtime check if the event (or one of its members) can contain an any field; an exception is thrown if the any field contains an object of type action, chunk, listener, or stream.