Developing Apama Applications > EPL Reference > Statements > Simple statements > The enqueue . . . to statement
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 .
You must enqueue an expression of type event, and the destination must 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.
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.
Enqueueing an event to a sequence of contexts is non-deterministic. For details, see Sending an event to a sequence of contexts.
In an enqueue...to statement, you cannot enqueue an event that has a field of type action, chunk, listener, or stream.
Copyright © 2013-2015 Software AG, Darmstadt, Germany and/or Software AG USA Inc., Reston, VA, USA, and/or its subsidiaries and/or its affiliates and/or their licensors.
Use, reproduction, transfer, publication or disclosure is prohibited except as specifically provided for in your License Agreement with Software AG.