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

高校档案网站建设的目的是什么产品网页设计公司

高校档案网站建设的目的是什么,产品网页设计公司,wordpress comments.php,腾讯云是做网站的吗背景 在flink中#xff0c;如果你想要访问记录的处理时间或者事件时间#xff0c;注册定时器#xff0c;或者是将记录输出到多个输出流中#xff0c;你都需要处理函数的帮助#xff0c;本文就来通过一个例子来讲解下副输出 副输出 本文还是基于streaming-with-flink这本…背景 在flink中如果你想要访问记录的处理时间或者事件时间注册定时器或者是将记录输出到多个输出流中你都需要处理函数的帮助本文就来通过一个例子来讲解下副输出 副输出 本文还是基于streaming-with-flink这本书的例子作为演示它实现一个把温度低于32度的记录输出到副输出的功能正常的记录还是从主输出中输出.代码如下 package wikiedits.processfunc.job;import org.apache.flink.streaming.api.datastream.DataStream; import org.apache.flink.streaming.api.datastream.SingleOutputStreamOperator; import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment; import org.apache.flink.util.OutputTag;import wikiedits.processfunc.pojo.SensorReading; import wikiedits.processfunc.process.FreezingMonitor; import wikiedits.processfunc.source.SensorSource;public class SideOutPutJob {public static void main(String[] args) throws Exception {StreamExecutionEnvironment see StreamExecutionEnvironment.getExecutionEnvironment();DataStreamSensorReading readings see.addSource(new SensorSource());SingleOutputStreamOperatorSensorReading monitoredReadings readings.process(new FreezingMonitor());// 打印附输出monitoredReadings.getSideOutput(new OutputTagString(freezing-alarms){}).print();// 打印主输出monitoredReadings.print();see.execute();} }package wikiedits.processfunc.process;import org.apache.flink.streaming.api.functions.ProcessFunction; import org.apache.flink.util.Collector; import org.apache.flink.util.OutputTag;import wikiedits.processfunc.pojo.SensorReading;public class FreezingMonitor extends ProcessFunctionSensorReading, SensorReading {private OutputTagString freezingAlarmOutput new OutputTagString(freezing-alarms) {};Overridepublic void processElement(SensorReading value, Context ctx, CollectorSensorReading out) throws Exception {if (value.temperature 32.0) {ctx.output(freezingAlarmOutput, freezing alarm for value.id : value.temperature);}out.collect(value);}} package wikiedits.processfunc.source;/** Copyright 2015 Fabian Hueske / Vasia Kalavri** Licensed under the Apache License, Version 2.0 (the License);* you may not use this file except in compliance with the License.* You may obtain a copy of the License at** http://www.apache.org/licenses/LICENSE-2.0** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an AS IS BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.* See the License for the specific language governing permissions and* limitations under the License.*/ import org.apache.flink.streaming.api.functions.source.RichParallelSourceFunction; import wikiedits.processfunc.pojo.SensorReading;import java.util.Calendar; import java.util.Random;/*** Flink SourceFunction to generate SensorReadings with random temperature values.** Each parallel instance of the source simulates 10 sensors which emit one sensor reading every 100 ms.** Note: This is a simple data-generating source function that does not checkpoint its state.* In case of a failure, the source does not replay any data.*/ public class SensorSource extends RichParallelSourceFunctionSensorReading {// flag indicating whether source is still runningprivate boolean running true;/** run() continuously emits SensorReadings by emitting them through the SourceContext. */Overridepublic void run(SourceContextSensorReading srcCtx) throws Exception {// initialize random number generatorRandom rand new Random();// look up index of this parallel taskint taskIdx this.getRuntimeContext().getIndexOfThisSubtask();// initialize sensor ids and temperaturesString[] sensorIds new String[10];double[] curFTemp new double[10];for (int i 0; i 10; i) {sensorIds[i] sensor_ (taskIdx * 10 i);curFTemp[i] 65 (rand.nextGaussian() * 20);}while (running) {// get current timelong curTime Calendar.getInstance().getTimeInMillis();// emit SensorReadingsfor (int i 0; i 10; i) {// update current temperaturecurFTemp[i] rand.nextGaussian() * 0.5;// emit readingsrcCtx.collect(new SensorReading(sensorIds[i], curTime, curFTemp[i]));}// wait for 100 msThread.sleep(3000);}}/** Cancels this SourceFunction. */Overridepublic void cancel() {this.running false;} } 程序运行结果
http://www.yutouwan.com/news/72975/

相关文章:

  • 山西孝义网站开发市场调研公司收费标准
  • 网站建设与运营实验贷款网站模板
  • 长沙娱乐网站开发网站优化排名哪家好
  • 网站 建设需帷客分享 wordpress
  • wordpress建站两秒打开科技网站设计公司排名
  • 陕西建设银行官网站高淳城乡建设局网站
  • win2012r2 建设网站采集网站如何收录
  • 滦平县建设局网站重庆中技互联
  • 福安网站开发化妆品公司网站源码
  • 织梦网站档目管理空白网页程序开发基础知识
  • 做养生产品哪个网站好wordpress三栏模板
  • 网站搜索怎么做的龙岗网页设计
  • 品质培训的网站建设jsp做网站步骤
  • 建立网站小程序国内做的比较好的协会网站
  • 建设网站的好公司做阿里巴巴网站 店铺装修免费吗
  • 网站备案负责人照片公司做网站推广的价格
  • 影视视频网站怎么做浏览器网址导航网
  • 乐云seo网站建设性价比高腾讯邮箱官网
  • 网站开发语言net网站年龄和域名年龄
  • 网站后台管理怎么进短网址生成源码
  • 怎样做视频上网站赚钱建设银行网站图片大全
  • 对整个网站做词频分析如何更改网站域名
  • 商务网站开发步骤网站出现的的问题
  • 网站域名做链接怎么做网站升级维护要多久
  • 天津公司网站建设费湖南做网站找谁
  • 门户网站制作定制国外公司在国内建网站
  • 石景山网站制作莱芜都市网直播
  • phpcms 外贸网站模板建站之星管理中心
  • 网站布局策划10m带宽做下载网站
  • 怎么直接做免费网站吗互联网是什么