Type-safe interfaces for implementing custom processing logic including window functions, process functions, and rich functions with lifecycle management.
trait WindowFunction[IN, OUT, KEY, W <: Window] {
def apply(key: KEY, window: W, input: Iterable[IN], out: Collector[OUT]): Unit
}
abstract class ProcessWindowFunction[IN, OUT, KEY, W <: Window] {
def process(key: KEY, context: Context, elements: Iterable[IN], out: Collector[OUT]): Unit
def clear(context: Context): Unit
}
trait AllWindowFunction[IN, OUT, W <: Window] {
def apply(window: W, input: Iterable[IN], out: Collector[OUT]): Unit
}abstract class RichWindowFunction[IN, OUT, KEY, W <: Window] extends WindowFunction[IN, OUT, KEY, W]
abstract class RichProcessWindowFunction[IN, OUT, KEY, W <: Window] extends ProcessWindowFunction[IN, OUT, KEY, W]
abstract class RichAllWindowFunction[IN, OUT, W <: Window] extends AllWindowFunction[IN, OUT, W]trait AsyncFunction[IN, OUT] {
def asyncInvoke(input: IN, collector: AsyncCollector[OUT]): Unit
}Function interfaces provide type-safe contracts for implementing custom processing logic with access to runtime context, state, and timers.