![](https://img.haomeiwen.com/i2189341/690b005f45889a08.png)
文章里面提到了2个问题,
- no state tracking
- do not support complex customized business logic
![](https://img.haomeiwen.com/i2189341/12475c1d80bd056a.png)
它们通过updateStateBykey(update_func)/mapWithState(update_func)
来自定义该update过程。即,
- Attach expire date/time when events are first seen & state is initialized
- drop the state if it expires
- apply business logic to new events/current state
![](https://img.haomeiwen.com/i2189341/34dde4e6434f53a9.png)
![](https://img.haomeiwen.com/i2189341/79f72927cf4f13b0.png)
我借用了该ppt的思路,试着回答了stackoverflow上面的一个类似提问,但是我自己没有亲身实现出来,只是觉得可能这是一个思路。在每个state initialization的时候初始化一些状态(timeout,control flag等),然后判断这个stages的去留。
网友评论