当前位置:网站首页>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
边栏推荐
- 001_redis设置存活时间
- Wechat public platform test number application, authorized login function and single sign on using hbuilder X and wechat developer tools
- JDBC JDBC
- 009_ Redis_ Getting started with redistemplate
- New book recommendation - IPv6 technology and application (Ruijie version)
- 005_redis_set集合
- Multithreading technology core
- WordPress calls the specified page content. 2 get_ children()
- Daily question (April 22, 2022) - rotation function
- Develop a chrome plug-in from 0 (2)
猜你喜欢
随机推荐
智能辅助功能丰富,思皓X6安全配置曝光:将于4月23日预售
Class initialization and instance initialization interview questions
A domestic image segmentation project is heavy and open source!
How to solve the complexity of project document management?
Latin goat (20204-2022) - daily question 1
011_ Redistemplate operation hash
Program design: l1-49 ladder race, allocation of seats (simulation), Buxiang pill hot
牛客手速月赛 48 C(差分都玩不明白了属于是)
On LAN
Hyperscan -- 2 compilation
006_ redis_ Jedis quick start
The 16th day of sprint to the big factory, noip popularization Group Three Kingdoms game
基于Torchserve部署SBERT模型<语义相似度任务>
小程序 canvas 画布半圆环
Daily question (April 22, 2022) - rotation function
Common formatting problems after word writing
[assembly language] understand "stack" from the lowest point of view
LeetCode 349. Intersection of two arrays (simple, array) Day12
【2019-CVPR-3D人体姿态估计】Fast and Robust Multi-Person 3D Pose Estimation from Multiple Views
JDBC JDBC






![[XJTU計算機網絡安全與管理]第二講 密碼技術](/img/b0/263e8dcbfeb2ce9f504a9c8eb76b07.png)

