Stream windowing in Flink applications

Within the application logic, you can add stream windowing after deciding the type of grouping on the unbounded data records. This way you can apply different computations on the windowed data which enables you to create more complex streaming applications.

The architecture of the windowing code depends on the type of stream, keyed or not, and the type of window assigner.

// If needed we create a window computation of the transaction summaries by item and time window
		if (params.getBoolean(ENABLE_SUMMARIES_KEY, false)) {
			DataStream<TransactionSummary> transactionSummaryStream = processedTransactions
					.keyBy("transaction.itemId")
					.timeWindow(Time.minutes(10))
					.aggregate(new TransactionSummaryAggregator())
					.name("Create Transaction Summary")
					.uid("Create Transaction Summary")
					.filter(new SummaryAlertingCondition(params))
					.name("Filter High failure rate");

			writeTransactionSummaries(params, transactionSummaryStream);
		}

		return env;
DataStream Class Definiton
.keyBy Defining key for keyed streams.
.timeWindow Type of windowing method with value.
.aggregate Data transformation type that is applied on the windowed data.
.uid Defining ID for the operator.
.filter Data transformation type that is applied on the windowed data.

To develop the windowing and to configure parameters, see the example of Apache Flink documentation.