Apama Documentation : Developing Apama Applications : Developing Apama Applications in EPL : Defining What Happens When Matching Events Are Found : Generating events : Generating events with the send command
Generating events with the send command
The send command sends an event to a channel, a context, a sequence of contexts, or a com.apama.Channel object.
When you send an event to a channel, the correlator delivers it to all contexts and external receivers that are subscribed to that channel. To send an event, use the following format:
send event_expression to expression;
The result type of event_expression must be an event. It cannot be a string representation of an event.
To send an event to a channel, the expression must resolve to a string or a com.apama.Channel object that contains a string. If there are no contexts and no external receivers that are subscribed to the specified channel, then the event is discarded. See Subscribing to channels.
The only exception to this is the default channel, which is the empty string. Events sent to the default channel go to all public contexts. All running Apama queries receive events sent on the default channel as well as events sent on the com.apama.queries channel. See Defining Queries.
To send an event to a context, the expression must resolve to a context, a sequence of contexts, or a com.apama.Channel object that contains a context. You must create a context before you send an event to the context. You cannot send 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()
   {
      send A() to c;
   }
}
If you send an event to a sequence of contexts and one of the contexts has not been created first, then the correlator terminates the monitor instance. Sending an event to a sequence of contexts is non-deterministic. You cannot send an event to a sequence of com.apama.Channel objects. For details, see Sending an event to a sequence of contexts.
All routable event types can be sent to contexts, including event types defined in monitors.
If a correlator is configured to connect to Universal Messaging, then a channel might have a corresponding Universal Messaging channel. If there is a corresponding Universal Messaging channel, then Universal Messaging is used to send the event to that Universal Messaging channel.
See Choosing when to use Universal Messaging channels and when to use Apama channels.
Copyright © 2013-2017 Software AG, Darmstadt, Germany. (Innovation Release)

Product LogoContact Support   |   Community   |   Feedback