Apama 10.7.2 | Developing Apama Applications | Developing Apama Applications in EPL | Defining Monitors | Adding predefined annotations
 
Adding predefined annotations
Some EPL language elements can take predefined annotations. They provide the runtime and Software AG Designer with extra information about these language elements. These predefined annotations can appear immediately before the following:
*Event declarations
*Actions in monitors or event definitions
Annotations have packaged names like events. Thus, either their full name, or (preferably) a using declaration should be added to the file to allow the name to be used without having to specify its full name. Annotations are written as an at symbol (@) followed by the name of the annotation, followed by parameters in parentheses. The values used in annotation parameters must be literals. If both annotations and ApamaDoc are specified, the order should be: ApamaDoc, followed by annotations, followed by the language element that they apply to.
The following annotations are available:
Annotation
Parameters
Description
SideEffectFree
None
This annotation is part of the com.apama.epl package and applies to action definitions. It tells the EPL compiler that this action has no side effects. When called from a log statement, the compiler is free to not call an action if it has no side effects and the log level is such that the log statement would not print anything to the log file. See Logging and printing.
OutOfOrder
None
This annotation is part of the com.apama.queries package and applies to event definitions. It tells the query runtime that these events may occur out of order. See Out of order events.
TimeFrom
string
This annotation is part of the com.apama.queries package and applies to event definitions. It tells the query runtime the default action name on the event definition to obtain source time from. See Using source timestamps of events.
Heartbeat
string
This annotation is part of the com.apama.queries package and applies to event definitions. It tells the query runtime the default heartbeat event type to use. See Using heartbeat events with source timestamps.
DefaultWait
string
This annotation is part of the com.apama.queries package and applies to event definitions. It tells the query editor in Software AG Designer the default time to wait to use. See Using source timestamps of events.
ExtraFieldsDict
string
This annotation is part of the com.softwareag.connectivity package and applies to event definitions. It names a field of type dictionary<string,string> where the apama.eventMap connectivity host plug-in will place unmapped entries. See Translating EPL events using the apama.eventMap host plug-in.
MessageId
string
This annotation is part of the com.softwareag.connectivity package and applies to event definitions. It names a field of an event type that should contain the unique identifier of the connectivity plug-in message that the event came from.
The field must be of type string and it can refer to a field nested in another event, for example:
MessageId("nestedEvent.fieldOfEvent")
You should not name a field that you expect to have a real value. See Using reliable transports and Reliable messaging with Digital Event Services.
Example:
using com.apama.epl.SideEffectFree;

monitor SomeMonitor {
action onload() {
on all Event() as e {
log prettyPrint(e) at DEBUG;
}
}

@SideEffectFree()
action prettyPrint(Event e) returns string {
return e.field1 +" : "+e.field2.toString();
}
}