You want to calculate the maximum value of a stock price every five minutes for stock prices collected over a five-minute time interval. You can use a tumbling Window transformation.
Create a mapping that reads stock prices and calculates the maximum value every five minute.
The following figure shows the example mapping:
You can use the following objects in your mapping:
Kafka Input
The input, Stock_Read, is a Kafka broker.
Window Transformation
The Window transformation, Window_Tumbling, accumulates data and returns a data group every five minute. Configure a window size of 5 minutes. The default slide interval is 5 minutes. The transformation streams data for five minutes and returns a data group every five minutes.
Aggregator
The Aggregator transformation calculates the maximum value of the stock price.
Kafka Ouptut
The output, Stock_Write, is a Kafka broker.
When you run the mapping, the Data Integration Service reads the data from the Kafka broker and passes it to the Window transformation. The window transformation groups the data and provides a data group every five minutes. The Aggregator transformation provides the maximum stock price. The output is written to a Kafka broker.