How do I trigger clear custom state in ProcessWindowsFunction

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

How do I trigger clear custom state in ProcessWindowsFunction

ゞ野蠻遊戲χ
Dear all:

How do I clear custom state in ProcessWindowsFunction? Because there is no onTimer method in ProcessAllWindowFunction.

Thanks
Jiazhi
Reply | Threaded
Open this post in threaded view
|

Re: How do I trigger clear custom state in ProcessWindowsFunction

David Anderson-3
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.


Regards,
David

On Sat, Jul 18, 2020 at 2:30 PM ゞ野蠻遊戲χ <[hidden email]> wrote:
Dear all:

How do I clear custom state in ProcessWindowsFunction? Because there is no onTimer method in ProcessAllWindowFunction.

Thanks
Jiazhi