Testing an Event Strategy with Static Data
Using records from a database table to test an Event Strategy involves configuring the input data source, setting up the Event Strategy to detect patterns in phone call records, and managing the output destination. This process allows for the effective evaluation of an Event Strategy before deploying it in a production environment, ensuring its efficiency and accuracy. By understanding these concepts, you can optimize the detection of patterns in data streams and improve the overall performance of the Event Strategy.
Video
Transcript
U+ Comms, a large telco, has developed an Event Strategy that looks for a pattern in a stream of events and emits an output when the pattern is detected. You have been asked to test the Event Strategy on static data stored in a database table before deploying it in the production environment.
In this demo, you learn how to test an Event Strategy using records from a database table. You need a Data Flow to test an Event Strategy. So, begin by creating a new Data Flow.
In the Apply to field, enter the name of the class that represents the input data for the Event Strategy. In this case, it is the class that represents the phone call detail records.
There are three key aspects of this Data Flow. First is the input data source for the Event Strategy. Second is the Event Strategy, which you add. The Event Strategy looks for patterns and emits an output when it finds the pattern. Third is the destination, which collects the Event Strategy output.
First, configure the input data source.
In this case, the data source is a report definition that contains a list of phone call detail records.
Examine this report definition more closely.
There is an important point to note here. The Event Strategy expects the timestamps of the events to be in ascending order. Thus, the list must be sorted on the Time of Call field. Then, in the Event Strategy, Time of Call must be configured as the property that contains the event timestamp.
Now, view the list of records for testing the Event Strategy. Notice that there are three dropped calls for phone number 111-1111 in the span of one week. There are three calls for phone number 222-2222 in one week, but only two calls dropped.
The second step is to configure the Data Flow with an Event Strategy.
Take a closer look at the Event Strategy. This Event Strategy emits an output when it detects three or more dropped calls for a phone number over a seven-day window.
Also, as mentioned earlier, the configuration of the Event Strategy uses a date-time property as the event timestamp. The system sorts the input data by using this property.
The output of the Event Strategy can have a different Data Model than the input. So, you must configure a class that represents the output of the Event Strategy.
You then need to map the properties of the input data with the properties of the Event Strategy output.
Map the phone number and the aggregated dropped calls count properties to corresponding properties from the input data.
The third step is to configure the destination. Configure it to write the output to a Data Set.
Now that the configuration is complete, you can run the Data Flow.
The Event Strategy has detected the pattern once from the six input records that it processed.
Check the details of the output.
As expected, the detected pattern corresponds to phone number 111-1111, which had three dropped calls in the span of one week.
You have now reached the end of this video. You have learned:
- How to test an Event Strategy in a Data Flow by using records from a database table.
This Topic is available in the following Modules:
Want to help us improve this content?