这是我要在Apache Flink中执行的操作:
输入import NavigationService from '@utils/navigation-service';
onReceived(notification) {
console.warn(notification.payload.additionalData);
console.warn('triggered');
NavigationService.navigate('Chat');
}
,然后输入Key By字段<StackLayout>
<SearchBar id="searchBar" hint="{{sbHint}}" text="{{sbText}}" clear="onClear" submit="onSubmit" />
<GridLayout rows="auto, *" class="list-group">
<lv:RadListView class="listview" items="{{itemList}}" pullToRefresh="true" pullToRefreshInitiated="onPullToRefreshInitiated" loaded="onListLoaded" itemTemplateSelector="selectItemTemplate" row="1">
<lv:RadListView.itemTemplates>
<template key="hasimg">
<GridLayout rows="auto" columns="70,*,auto" class="list-group-item" tap="select">
<Image row="0" col="0" src="{{imgurl}}" width="60" height="50" stretch="aspectFill"/>
<Label row="0" col="1" class="p-l-15 text" text="{{ name }}"/>
<Label class="p-l-15 fa" text="" row="0" col="2"/>
</GridLayout>
</template>
<template key="noimg">
<GridLayout rows="auto" columns="70,*,auto" class="list-group-item" tap="select">
<Label class="fa imgicon" text="" row="0" col="0"/>
<Label row="0" col="1" class="p-l-15 text" text="{{ name }}"/>
<Label class="p-l-15 fa" text="" row="0" col="2"/>
</GridLayout>
</template>
</lv:RadListView.itemTemplates>
</lv:RadListView>
<ActivityIndicator busy="{{ isLoading }}" row="1" horizontalAlignment="center" verticalAlignment="center"/>
</GridLayout>
</StackLayout>
,然后做一个15分钟的滑动窗口,每分钟滑动一次,汇总每个键的结果(DataStream<T>
),然后将所有这些聚合汇总到一个列表中
基本上,如果我有一个输入流x
,则希望通过在15分钟的滑动窗口上以及对此特定滑动窗口上进行操作,将结果为x
。
这可能吗?
答案 0 :(得分:1)
是的,确实有可能。 Flink的窗口API使您可以在键控窗口之后跟随非键控窗口。来自Apache Flink培训站点的This exercise涵盖了这种模式。另外,在this page上有关窗口的“惊喜”列表中查找标题为“ Windows可以跟随Windows”的部分。
大致上,您将这样做:
stream
.keyBy(e -> e.x)
.timeWindow(Time.minutes(15), Time.minutes(1))
.process(new ProduceKeyedResults())
.timeWindowAll(Time.minutes(15), Time.minutes(1))
.process(new ProduceOverallResults())
您可能更愿意使用ReduceFunction
或AggregateFunction
来代替WindowProcessFunctions
或作为其补充。
您会注意到,时间窗口运算符产生的事件具有反映窗口本身时间边界的时间戳,而不是与落入窗口中的事件的时间戳有关。但是事件确实具有时间戳,并且流仍带有水印-因此再次进行时间戳分配没有意义。 (还值得注意的是,键控窗口产生的流不再被键控。)