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

阿里云服务器建网站福州市市政建设开发有限公司网站

阿里云服务器建网站,福州市市政建设开发有限公司网站,永远免费的域名,清河网站建设公司1.为啥不使用cep呢#xff0c;cep的超时时间设置不好配置化#xff0c;无法满足扩展要求 2.超时怎么界定。A事件发生后#xff0c;过了N时间#xff0c;还没有收到B事件#xff0c;算超时。 代码如下#xff1a; import com.alibaba.fastjson.JSONObject; import lombo…1.为啥不使用cep呢cep的超时时间设置不好配置化无法满足扩展要求 2.超时怎么界定。A事件发生后过了N时间还没有收到B事件算超时。 代码如下 import com.alibaba.fastjson.JSONObject; import lombok.extern.slf4j.Slf4j; import org.apache.flink.api.common.state.ValueState; import org.apache.flink.api.common.state.ValueStateDescriptor; import org.apache.flink.configuration.Configuration; import org.apache.flink.streaming.api.functions.KeyedProcessFunction; import org.apache.flink.util.Collector;Slf4j public class AsyncModelTimeoutHandler extends KeyedProcessFunctionString, JSONObject, JSONObject {private static final long serialVersionUID -61608451659272532L;private transient ValueStateLong firstDataTime;private transient ValueStateLong secondDataTime;private transient ValueStateString eventType;Overridepublic void open(Configuration parameters) throws Exception {ValueStateDescriptorLong firstDataDescriptor new ValueStateDescriptor(firstDataTime, Long.class);firstDataTime getRuntimeContext().getState(firstDataDescriptor);ValueStateDescriptorLong secondDataDescriptor new ValueStateDescriptor(secondDataTime, Long.class);secondDataTime getRuntimeContext().getState(secondDataDescriptor);ValueStateDescriptorString eventTypeDescriptor new ValueStateDescriptor(eventType, String.class);eventType getRuntimeContext().getState(eventTypeDescriptor);}Overridepublic void processElement(JSONObject value, KeyedProcessFunctionString, JSONObject, JSONObject.Context ctx, CollectorJSONObject out) throws Exception {Long currentTimestamp value.getLong(ts);if (value.containsKey(timeout)) {//异步请求消息long timeout value.getLong(timeout);firstDataTime.update(currentTimestamp timeout);eventType.update(value.getString(event));ctx.timerService().registerProcessingTimeTimer(currentTimestamp timeout);} else {secondDataTime.update(currentTimestamp);}}Overridepublic void onTimer(long timestamp, KeyedProcessFunctionString, JSONObject, JSONObject.OnTimerContext ctx, CollectorJSONObject out) throws Exception {Long firstTime firstDataTime.value();Long lastTime secondDataTime.value();if (lastTime null || (firstTime ! null lastTime firstTime)) {//超时了log.info(AsyncModelTimeoutHandler onTimer handle triggerTime{}, firstTime{}, secondTime{},key{}, timestamp, firstTime, lastTime, ctx.getCurrentKey());JSONObject r new JSONObject();r.put(id, ctx.getCurrentKey());r.put(judgeTime, timestamp);r.put(event, eventType.value());out.collect(r);}firstDataTime.clear();secondDataTime.clear();eventType.clear();} }
http://www.dnsts.com.cn/news/4698.html

相关文章:

  • 黑龙江省住房和城乡建设厅网站郑州营销网站托管公司哪家好
  • 电子商务网站建设的策划书用织梦做网站调用乱码
  • 做网站生成二维码建设网站需要体现的流程有哪些
  • 郑州易站通网站公司做关于时尚网站的目的
  • 企业官方网站制作推广软件网站建设续费合同
  • 长春火车站照片网站小程序
  • 自主式响应网站wordpress文章加密提示
  • 51网站统计购物商城html网站代码
  • 重庆模板网站建站租房信息网站建设
  • 金融公司网站建设模板wordpress自动添加标签
  • 网站导航规划怎么在百度上发表文章
  • 网页设计学校网站制作做百度移动网站排名
  • 租一个国外的服务器 建设网站智慧校园系统平台
  • 海南省建设注册中心网站杂志在线设计网站
  • 安徽宿州住房与城乡建设玩网站网站视频接口 怎么做
  • 国外优秀vi设计网站深圳制作网站的公司
  • 做网站的目的是什么傻瓜式php网站开发工具
  • 做设备租赁的网站全媒体广告策划与营销
  • 南京建设个人网站建筑设计说明模板
  • 天成信息网站建设自助建站平台建设部职业资格注册中心网站
  • 中国建设网官方网站企业网银设计上海展会2023
  • 怎样知道哪个网站做推广好2021可以访问黄的浏览器
  • 惠民网站建设d开头的做网站的软件
  • 天津市做网站的公司有哪些企业网站建设技巧
  • 杭州建设信用网新网站建立网站加强家园沟通和联系的利弊
  • php购物网站开发设计网站抓取超时错误
  • 那里有制作网站公司自由建网站的网络程序
  • 怎么用html做百度首页网站ps做图下载网站
  • html5网站框架简单的网站建设怎么做
  • 前端学习网站绵阳 网站建设