The API changes are the following additions to TWindow<T,K>:
"
TStream batch(BiFunction<List,K,B> batcher)
TStream batch(BiFunction<List,K,B> batcher, long time, TimeUnit unit)
Process a window in batches. batcher is called when a partition in this window is complete.
Once a partition in this window is complete batcher is called passing the current contents of the partition. When batcher returns, the partition contents are discarded and the partition starts to fill again, the window partition tumbles.
This means the window partition is processed in non-overlapping batches, a tuple is only processed once by batcher.
For a count based window of size N a partition becomes complete when it contains N tuples.
For example with last(10) batcher will be called after the partition has received ten tuples passing the first ten tuples (1-10), then after a further ten tuples have been received batcher is called passing tuples 11-20, etc. Thus at the time the partition is visible, when batcher is called, the partition contains the last ten tuples on the stream for its key, which is its definition.
For time based windows a partition of S seconds becomes complete (approximately) every S seconds starting when it receives its first tuple on the stream. If no tuples arrived during the time the partition was waiting to become complete then batcher is called passing an empty list of tuples.
For example last(5, SECONDS) at the time the partition is visible, when batcher is called, the partition contains the last fives seconds of tuples on the stream for its key, which is its definition."