当前位置: 首页 > news >正文

静态展示类网站东莞医疗网站建设报价

静态展示类网站,东莞医疗网站建设报价,泰安招聘,关键词优化推广排名软件一 、 AllowedLateness API 延时关闭窗口 AllowedLateness 方法需要基于 WindowedStream 调用。AllowedLateness 需要设置一个延时时间#xff0c;注意这个时间决定了窗口真正关闭的时间#xff0c;而且是加上WaterMark的时间#xff0c;例如 WaterMark的延时时间为2s…一 、 AllowedLateness API 延时关闭窗口 AllowedLateness 方法需要基于 WindowedStream 调用。AllowedLateness 需要设置一个延时时间注意这个时间决定了窗口真正关闭的时间而且是加上WaterMark的时间例如 WaterMark的延时时间为2sAllowedLateness 的时间为2s那一个10的滚动窗口0-10这个单位窗口正常的关窗时间应该是超过12s的数据到达之后就关窗。而AllowedLateness 是在12s的基础上继续延长了2s也就是在14s的时候才真正去关闭 0-10s的窗口但是在12s的时候会触发窗口计算从12s之后到14s的数据每到达一个就会触发一次窗口计算。 二 、 OutputTag API 侧输出流 使用 OutputTag API 保证窗口关闭的数据依然可以获取窗口到达AllowedLateness 时间后将彻底关闭此时再属于该窗口范围内的数据将会流向 OutputTag 。 context.collect(new Event(A, /user, 1000L));Thread.sleep(3000);context.collect(new Event(B, /prod, 6500L));Thread.sleep(3000);context.collect(new Event(C, /cart, 4000L));Thread.sleep(3000);context.collect(new Event(D, /user, 7500L));System.out.println(窗口关闭 ~ );Thread.sleep(3000);context.collect(new Event(E, /cente, 8500L));Thread.sleep(3000);context.collect(new Event(F, /cente, 4000L));Thread.sleep(3000);context.collect(new Event(G, /cente, 9200L));Thread.sleep(3000);context.collect(new Event(H, /cente, 1000L));Thread.sleep(3000);context.collect(new Event(I, /cente, 1500L));Thread.sleep(3000);如果现在定义一个 5s的 滚动窗口WaterMark延时时间为2sAllowedLateness 延时时间为2s此时相当于是 WaterMark到达9s的时候才会关闭0-5的窗口也就是说最后两条数据会流向OutputTag . 当4000L数据到达后会再次触发一次窗口计算。 完全与预期一致。 完整代码 public class WindowOutputTest {public static void main(String[] args) throws Exception {StreamExecutionEnvironment env Env.getEnv();DataStreamSourceEvent dataStreamSource env.addSource(new SourceFunctionEvent() {Overridepublic void run(SourceContextEvent context) throws Exception {context.collect(new Event(A, /user, 1000L));Thread.sleep(3000);context.collect(new Event(B, /prod, 6500L));Thread.sleep(3000);context.collect(new Event(C, /cart, 4000L));Thread.sleep(3000);context.collect(new Event(D, /user, 7500L));System.out.println(窗口关闭 ~ );Thread.sleep(3000);context.collect(new Event(E, /cente, 8500L));Thread.sleep(3000);context.collect(new Event(F, /cente, 4000L));Thread.sleep(3000);context.collect(new Event(G, /cente, 9200L));Thread.sleep(3000);context.collect(new Event(H, /cente, 1000L));Thread.sleep(3000);context.collect(new Event(I, /cente, 1500L));Thread.sleep(3000);}Overridepublic void cancel() {}});//operatorSingleOutputStreamOperatorEvent operator dataStreamSource.assignTimestampsAndWatermarks(WatermarkStrategy.EventforBoundedOutOfOrderness(Duration.ofSeconds(2))// 水位线延时2s.withTimestampAssigner(new SerializableTimestampAssignerEvent() {Overridepublic long extractTimestamp(Event event, long l) {return event.timestamp;}}));OutputTagEvent eventOutputTag new OutputTagEvent(late) {};WindowedStreamEvent, Boolean, TimeWindow windowedStream operator.keyBy(d - true).window(TumblingEventTimeWindows.of(Time.of(5, TimeUnit.SECONDS))).allowedLateness(Time.of(2, TimeUnit.SECONDS)).sideOutputLateData(eventOutputTag);SingleOutputStreamOperatorString windowAgg windowedStream.aggregate(new AggregateFunctionEvent, Long, Long() {Overridepublic Long createAccumulator() {return 0L;}Overridepublic Long add(Event event, Long acc) {return acc 1;}Overridepublic Long getResult(Long acc) {return acc;}Overridepublic Long merge(Long aLong, Long acc1) {return null;}}, new ProcessWindowFunctionLong, String, Boolean, TimeWindow() {Overridepublic void process(Boolean key, Context context, IterableLong iterable, CollectorString collector) throws Exception {long start context.window().getStart();long end context.window().getEnd();collector.collect(new Timestamp(start) ~ new Timestamp(end) iterable.iterator().next());}});windowAgg.print(窗口数据 );//获取测输出流中的延时数据DataStreamEvent sideOutput windowAgg.getSideOutput(eventOutputTag);sideOutput.print(测输出流- );env.execute();}}
http://www.dnsts.com.cn/news/34886.html

相关文章:

  • 怎么自己做网站地图湖北网站设计流程
  • seo网站排名优化价格韶关网站seo
  • 网站跳出率如何计算在北京做网站制作一个月多少钱
  • 水墨画风格网站展厅布展方案设计
  • 做微信推送网站企业安全文化建设导则
  • 亅新厦建设集团网站做网站卖机器怎么弄
  • 网站建设软件是什么意思深圳网站建设要多少钱
  • 网站服务器有哪些wordpress练习
  • 如何免费建站云南楚雄医药高等专科学校
  • 个性化网站制作wordpress免费采集
  • 建设网站类型网站怎么更改关键词
  • 做图片网站用什么程序wordpress仿站cms
  • 做系统之前的网站无锡网站的建设
  • 罗琳做的网站深圳市龙华区民治街道
  • 手机网站设计制作公司做网站怎么那么难
  • 网站建设策划书结束语昆明二级站seo整站优化排名
  • 春节网站怎么做价格低怎么说
  • 秦皇岛网站制作小程序开发宁波网站建设 网络服务
  • 网站推广制作附子seo
  • 别人做的网站不能用怎么办巴中交通建设有限公司网站
  • 精品课程网站建设总结报告天眼查询系统
  • 网站怎样做的高大上有错误的wordpress
  • 南京网站制作哪家专业外贸网站建设哪家有名
  • 六安城市网优选佛山网站关键词优化公司
  • 网站建设费钱吗wordpress怎么增加按钮
  • 免费画图网站平阴网站建设费用
  • 哈尔滨网站建设制作费用网页设计和网站制作
  • iis7发布网站教程做专题页的背景网站
  • 什么语言做网站快简诉网站建设的基本流程
  • 衡水高端网站建设动漫设计和动漫制作技术的区别