Re: How do I trigger clear custom state in ProcessWindowsFunction
ProcessWindowFunction#process is passed a Context object that contains
public abstract KeyedStateStore windowState(); public abstract KeyedStateStore globalState();
which are available for you to use for custom state. Whatever you store in windowState is scoped to a window, and is cleared when that window is cleared (this is only useful for windows that may have multiple firings). On the other hand, state that you create in globalState is retained indefinitely. If you have an unbounded key space with keys that become stale (such as sessionIds), you will want to use state TTL [1] on the state descriptor(s) to arrange for its eventual deletion.