Enqueuing to contexts
To enqueue an event to a particular context, use the following form of the enqueue 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 command.
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 sends the event to the context's input queue and not to the special enqueue 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 in
Developing Apama Applications in EPL.
Enqueueing an event to a sequence of contexts is non-deterministic. For details, see
Sending an event to a sequence of contexts in
Developing Apama Applications in EPL.
All routable event types can be enqueued to contexts, including event types defined in monitors.