The enqueue . . . to statement
The enqueue...to statement sends an event to a context you identify.
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 .
Enqueue . . ToStatement
Rule components
The result type of the first Expression must be event. It cannot be a string representation of an event.
The result type of the second Expression can be one of the following:
context — The
enqueue...to statement sends an event to the back of the input queue of the specified context. The expression is evaluated and the resulting event is sent to the input queue of only the specified context.
sequence<context> — The
enqueue...to statement sends a copy of the event to the back of the input queue of each context in the specified sequence. The expression is evaluated and the resulting event is sent to the input queue of all the contexts in the sequence.
For example:
sequence <context> ctxs := [ c1, c2, c3 ];
Ping ping = Ping();
enqueue ping to ctxs;
You cannot enqueue an event to a com.apama.Channel object that contains a context. You cannot enqueue an event to a dictionary of contexts. However, it is a common pattern to enqueue to a sequence generated by dictionary.values(). For example:
enqueue x to d.values;
If the target context's input queue is full the sending context blocks and waits for space on the queue unless doing so would cause a deadlock. See
Deadlock avoidance when parallel processing in
Developing Apama Applications in EPL.
Note that enqueued events are processed in the order they are enqueued. Enqueued events are put on the back of the input queue, behind any externally sourced events already queued.
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.
In an enqueue...to statement, you cannot enqueue an event that has a field of type action, chunk, listener, or stream.