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 with particular content
 
Listening for events with particular content
The sample monitor is very simple. It just logs all StockTick events. The content of the StockTick event is not relevant when matching. See Example of a simple monitor. However, you can filter events according to their content. To alter the example so that the monitor logs only StockTick events for a given stock, you must specify a filter on the first field in the event template. For example, suppose you want to log only ACME stock ticks. You need to change the following line:
on all StockTick(*,*):newTick processTick();
to this:
on all StockTick("ACME",*):newTick processTick();
Now the event listener triggers on only StockTick events whose name field matches ACME.
To filter StockTick events based on their price, you might specify the event template shown below. This event template specifies that you are interested in all StockTick events whose price is 50.5 or greater.
on all StockTick(*, >=50.5):newTick processTick();

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.