当前位置:网站首页>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
边栏推荐
- They are all intelligent in the whole house. What's the difference between aqara and homekit?
- go语言打怪通关之 ⌈互斥锁和状态协程⌋
- Time. In ANSI standard library H header file
- Lane cross domain problem
- Consider defining a bean of type 'com netflix. discovery. AbstractDiscoveryClientOptionalArgs‘
- Program design: l1-49 ladder race, allocation of seats (simulation), Buxiang pill hot
- 一、序列模型-sequence model
- [suggestion collection] hematemesis sorting out golang interview dry goods 21 questions - hanging interviewer-1
- Develop a chrome plug-in from 0 (2)
- LeetCode 283. Move zero (simple, array) Day12
猜你喜欢
Global, exclusive and local routing guard
R language advanced | generalized vector and attribute analysis
下载正版Origin Pro 2022 教程 及 如何 激 活
智能辅助功能丰富,思皓X6安全配置曝光:将于4月23日预售
1、 Sequence model
SO库依赖问题
每日一题(2022-04-22)——旋转函数
[XJTU计算机网络安全与管理]第二讲 密码技术
PTA: 浪漫倒影 [二叉树重建] [深度优先遍历]
How to solve the complexity of project document management?
随机推荐
类初始化和实例初始化面试题
How many steps are there from open source enthusiasts to Apache directors?
SQL server2019无法下载所需文件,这可能表示安装程序的版本不再受支持,怎么办了
Common formatting problems after word writing
小程序 canvas 画布半圆环
C standard library - < time h>
PTA: 浪漫倒影 [二叉树重建] [深度优先遍历]
SO库依赖问题
JVM类加载器
Hyperscan -- 2 compilation
[xjtu Computer Network Security and Management] session 2 Cryptographic Technology
Target narak
Understanding process (multithreading primary)
001_redis设置存活时间
So library dependency
MySQL JDBC编程
The 16th day of sprint to the big factory, noip popularization Group Three Kingdoms game
智能辅助功能丰富,思皓X6安全配置曝光:将于4月23日预售
002_ Redis_ Common operation commands of string type
Consider defining a bean of type 'com netflix. discovery. AbstractDiscoveryClientOptionalArgs‘