Apache flink Flink-如何实现自定义会话窗口,在特定事件上创建窗口,并在一段会话时间后触发?

Apache flink Flink-如何实现自定义会话窗口,在特定事件上创建窗口,并在一段会话时间后触发?,apache-flink,flink-streaming,Apache Flink,Flink Streaming,我的输入流 type=1, time=10, start=123, other params type=2, time=11, start=123, other params type=2, time=12, start=123, other params type=1, time=13, start=235, other params type=2, time=14, start=123, other params type=2, time=15, start=235, other param

我的输入流

type=1, time=10, start=123, other params
type=2, time=11, start=123, other params
type=2, time=12, start=123, other params
type=1, time=13, start=235, other params
type=2, time=14, start=123, other params
type=2, time=15, start=235, other params
type=2, time=16, start=235, other params
type=1, time=17, start=456, other params
...
我想创建一个以type=1事件开始的窗口。在那之后,我一直有type=2事件,直到key start=123停止

Type=1事件类似于start事件,Type=2事件类似于ping事件,表示生产者仍处于活动状态。我有两个不同的主题

我想创建一个自定义会话窗口,当type=1事件发生时开始,该窗口将一直打开,直到距离最后一个type=2事件超过3分钟

stream
  .keyBy(start)
  .window(CustomWindow())
  .trigger(CustomTrigger())
  ...
但是,我不知道如何创建一个仅在接收到事件类型=1时启动的自定义窗口。我读过关于触发器的书,它是关于窗口函数应该在什么时候启动,而不是什么时候创建窗口

预期结果:

type=event-end, start=123, duration=3 (because there are 3 type=2 log for 123)
-> this fires at time=17 because last ping event is at time=14, there is a gap of 3.
type=event-end, start=235, duration=2 (because there are 3 type=2 log for 123)
-> this fires at time=19 because last ping event is at time=16, there is a gap of 3 and if there is no more ping after time=16.

如何在Flink中实现此自定义窗口?

我相信这就是您想要的。定义您自己分配和触发窗口的逻辑。

我也有类似的问题。如果你能解决这个问题,你能帮我吗。