当前位置:网站首页>Flink stream processing engine system learning (III)
Flink stream processing engine system learning (III)
2022-04-23 02:36:00 【Fat brother 1930】
Preface
One more Flink Of stream Of example, Say it in advance , The example on the official website is a bit of a pit .
One 、stream Example

Copy to my directory ( By the way, the next good tool is really fragrant ,idea Code that can be copied , Paste automatically create classes with me )

What do you want to write , That's true. , Don't ask yet , Keep looking down .
Two 、example Arrangement
1. Depend on the introduction of
You copy it to your demo project , When automatic bag drawing , You will find a lot of missing objects .
The first thing we need to do is introduce flink-connector-files
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-connector-files</artifactId>
<version>${
flink.version}</version>
</dependency>
2. Why is there TextLineInputFormat class
Finish the steps above , You should find that this class is missing . First of all , The example here is actually written according to the latest snapshot version , Go back and see example Of pom Will find .

I started from maven Download to this version , use luyten open jar, I found that this class really exists .

So I created such a class , Here's the thing , If you use the latest version 1.14.4 edition , In fact, that line of code can be written in another way .
FileSource.FileSourceBuilder<String> builder =
// FileSource.forRecordStreamFormat(
//new TextLineInputFormat(), params.getInputs().get()); 1.16-SNAPSHOT edition
FileSource.forRecordStreamFormat(new TextLineFormat()
, params.getInputs().get()); //1.14.4 edition
The right of final interpretation , Or from the official website , On the official website 1.14.4 Version of Search Box input Text, Will appear Text Files The drop-down , Click on , You will jump to the syntax usage example

3. There are also error reporting tips

Click on MemorySize Methods ofMebiBytes See the realization , Make sure you can write directly long value , in addition , below Duration It's also popular here , Change :
counts.sinkTo(
FileSink.<Tuple2<String, Integer>>forRowFormat(
params.getOutput().get(), new SimpleStringEncoder<>())
.withRollingPolicy(
DefaultRollingPolicy.builder()
.withMaxPartSize(20)
.withRolloverInterval(10)
.build())
.build())
.name("file-sink");
3、 ... and 、 function example

Report errors , I checked the reasons and didn't explain , Look, it literally means , Cannot use private final bytes ...
PS: Speaking of this, I suddenly thought ,jdk stay 9 Will be realized by char[] Changed to byte[] 了 , The meaning is that it can save memory .
In fact, I doubt whether it is jdk17 Yes bug, Finally, I suddenly thought of building the official website demo Where the project script is located 2 Sentence :

therefore , Switch demo Of build&run Of jdk edition ,idea Switch here :

Run again

The familiar partition statistics are coming out again , Are you very happy !!!
summary
1、 Read the official website example Also a lot of , Later learning may not be shared with everyone , Some of them are definitely not needed for the time being .
2、 my CSDN Learning members Flink This course has 100 lesson , Learning should be accelerated , There may be no special time to study later , Only in actual combat get 了 .
I hope I can help you , Off work , get home .
版权声明
本文为[Fat brother 1930]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204220822178447.html
边栏推荐
- Wechat public platform test number application, authorized login function and single sign on using hbuilder X and wechat developer tools
- 【unity3D】直播间滚动式弹幕效果
- SO库依赖问题
- Understanding process (multithreading primary)
- 006_redis_jedis快速入门
- hack the box optimum靶机
- 程序设计天梯赛 L1-49 天梯赛分配座位(模拟),布响丸辣
- New book recommendation - IPv6 technology and application (Ruijie version)
- Usage of vector common interface
- C standard library - < time h>
猜你喜欢

十六、异常检测

Hack the box optimum

011_ Redistemplate operation hash

全局、独享、局部路由守卫
![Handwritten memory pool and principle code analysis [C language]](/img/9e/fdddaa628347355b9bcf9780779fa4.png)
Handwritten memory pool and principle code analysis [C language]

How to prevent leakage of operation and maintenance data

How to solve the complexity of project document management?

Jupyter for local and remote access to ECS

Common formatting problems after word writing

Talk about biology live broadcast: Dr. Wang Ziyuan, a lake view biology, exploring hepatitis B with gene therapy
随机推荐
This is how the power circuit is designed
[XJTU computer network security and management] Lecture 2 password technology
89 logistic regression user portrait user response prediction
SO库依赖问题
010_ StringRedisTemplate
每日一题(2022-04-21)——山羊拉丁文
Talk about current limiting
Class initialization and instance initialization interview questions
hyperscan --- 1
PTA: praise the crazy devil
假如404页面是这样的 | 每日趣闻
认识进程(多线程_初阶)
IAR embedded development stm32f103c8t6 Lighting LED
MySQL JDBC编程
Consider defining a bean of type ‘com.netflix.discovery.AbstractDiscoveryClientOptionalArgs‘
go语言打怪通关之 ⌈互斥锁和状态协程⌋
Flink real-time data warehouse project - Design and implementation of DWS layer
想用Mac学习sql,主要给自己个充足理由买Mac听听意见
005_redis_set集合
【无标题】