Apama 10.3.1 | Apama Documentation | Developing Apama Applications | Developing Apama Applications in EPL | Defining Event Listeners | Defining event expressions with one event template | Listening for events of all types
 
Listening for events of all types
You can specify a listener which listens for all events types as shown below:
on any() as anyVar {
print "Event received : " + anyVar.toString();
}
In the above listener, the on any() event template will match against all events in the corresponding context, regardless of their type.
You can provide an optional typeName to specify which type you are listening for. This must name a routable type.
You can provide an optional values. This must be a dictionary<string, any> which names indexable fields. The listener will filter to only match events where all of the specified fields are equal. If you specify values, you must also specify the typeName. For example:
dictionary<string, any> values := {"quantity", 100};
on any(typeName="Event", values = values)
The above definition is equivalent to:
on Event(quantity=100)
Example:
event A{}
event B{}
 
on all any() as anyVar {
print "Event received : " + anyVar.toString();
}
 
route A(); //listener fires
route B(); //listener fires
You can use all event expression operators (all, and, not, -> and so on) with the any listener.
Note: Due to unpredictable results, it is recommended that you do not use any() listeners in onload actions. Instead, do so in response to an event (a start event or, more likely, a configuration event) once everything has been injected.

Copyright © 2013-2019 | 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.