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

vps怎么上传网站程序内容企业推广

vps怎么上传网站程序,内容企业推广,辽宁建设工程信息网登录入口官方,nba最新排名东西部排名榜概述 SourceFunction:非并行数据源(并行度只能1) --接口 RichSourceFunction:多功能非并行数据源(并行度只能1) --类 ParallelSourceFunction:并行数据源(并行度能够>1) --接口 RichParallelSourceFunction:多功能并行数据源(并行度能够>1) --类 【建议使用的】 ——…

概述

SourceFunction:非并行数据源(并行度只能=1) --接口

RichSourceFunction:多功能非并行数据源(并行度只能=1) --类

ParallelSourceFunction:并行数据源(并行度能够>=1) --接口

RichParallelSourceFunction:多功能并行数据源(并行度能够>=1) --类 【建议使用的】

——Rich 字样代表富有,在编程中,富有代表可以调用的方法很多,功能很全的意思。

 基础案例

package com.bigdata.day02;//1、SourceFunction
// public class ZidingyiSource implements SourceFunction<Student> {
//2、RichSourceFunction
// public class ZidingyiSource extends RichSourceFunction<Student> {
//3、ParallelSourceFunction
//public class ZidingyiSource implements ParallelSourceFunction<Student> {
//4、RichParallelSourceFunction
//public class ZidingyiSource extends RichParallelSourceFunction<Student> {
// 推荐的
public class ZidingyiSource extends RichParallelSourceFunction<Student> {// ctrl + oprivate final Random random = new Random();private boolean flag = true;// 现在不用@Overridepublic void open(Configuration parameters) throws Exception {System.out.println("实现一些资源的开启");}// 现在不用@Overridepublic void close() throws Exception {System.out.println("实现一些资源的关闭");}@Overridepublic void run(SourceContext<Student> sourceContext) throws Exception {while (flag){String stu_id = UUID.randomUUID().toString();String stu_name = "Student_"+stu_id;int stu_age = random.nextInt(8)+10;long stu_timestamp = System.currentTimeMillis();Student student = new Student(stu_id,stu_name,stu_age,stu_timestamp);sourceContext.collect(student);Thread.sleep(1000);}}// 具体什么时候 会调用还不知道@Overridepublic void cancel() {flag = false;System.out.println("停止运行");}
}//调用
public class ZiDingYi {public static void main(String[] args) throws Exception {StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();// add + new DataStreamSource<Student> studentDataStreamSource = env.addSource(new ZidingyiSource());int parallelism = studentDataStreamSource.getParallelism();System.out.println(parallelism);// print之前与之后的并行度是不同的studentDataStreamSource.print().setParallelism(1);env.execute();}
}

cancel+open+close的调用时机

package com.bigdata.day02;import java.util.Objects;/*
* 1、这几个方法都会按照并行度调用多次 调度的次数 按照studentDataStreamSource的并行度
*
*/public class ZiDingYi {public static void main(String[] args) throws Exception {// 在上面案例的基础上实现StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();DataStreamSource<Student> studentDataStreamSource = env.addSource(new ZidingyiSource());// 此时就只会调用一次了studentDataStreamSource.setParallelism(1);// 此时打印也会有多个并行度(8个cpu)studentDataStreamSource.print();// 异步调用 此时会调用open方法JobExecutionResult execute = env.execute();JobClient flink_job = env.executeAsync("Flink Job");Thread.sleep(3000);// 此时会调用 cancel 和 close flink_job.cancel();}
}

 kafkaSource

package com.bigdata.day02;import java.util.Properties;public class KafkaSource {public static void main(String[] args) throws Exception{//envStreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();// properties Properties properties = new Properties();properties.setProperty("bootstrap.servers", "bigdata01:9092");properties.setProperty("group.id", "g1");// consumerFlinkKafkaConsumer<String> consumer= new FlinkKafkaConsumer<String>("yhedu",new SimpleStringSchema(),properties);// sourceDataStreamSource<String> dataStreamSource = env.addSource(consumer);dataStreamSource.filter(new FilterFunction<String>() {@Overridepublic boolean filter(String s) throws Exception {return s.contains("success");}}).print();env.execute();}
}

http://www.khdw.cn/news/27130.html

相关文章:

  • wordpress装在根目录文件夹中_如何通过域名直接访问?泰安seo公司
  • 南昌房产网官方网站十大app开发公司排名
  • wordpress开启raid霸榜seo
  • h5网站开发公司高端网站定制设计
  • 建设网站建设什么征琴江苏seo推广
  • 上海建设工程招投标在什么网站疫情防控最新通告
  • 整合营销案例百度推广账户优化
  • 拍拍网站源码百度竞价托管
  • 外贸网站建站赚钱容易被百度收录的网站
  • 网站建设合同 简单营销方案网站
  • 一键建站平台论坛推广怎么做
  • wordpress家居主题朝阳seo推广
  • 重庆公司印章代码查询站群seo
  • 网站成本案例合肥百度关键词优化
  • wordpress媒体库创建文件夹站长工具seo综合查询可以访问
  • 网站用图片发布新闻稿
  • wordpress 作品集是什么天津seo外包平台
  • 政府网站架构可以免费领取会员的软件
  • 广西网络网站建设2022年最新最有效的营销模式
  • 聊城哪里网站做的好搜索引擎营销的分类
  • 福田做网站报价怎么快速优化关键词排名
  • 自助分红网站建设seo运营是做什么的
  • 手机建个人网站谷歌搜索引擎怎么才能用
  • 可以生成静态网站源码什么平台引流最快
  • 交河做网站百度推广的优化软件
  • 易企秀怎么做网站itmc平台seo优化关键词个数
  • qq空间钓鱼网站制作小程序开发平台有哪些
  • 美橙网站开发搜索引擎营销的特点是什么
  • 百度云加速汕头seo全网营销
  • 外 网站 公司最新nba排名