当前位置:网站首页>[Flink] rich function
[Flink] rich function
2022-07-25 03:27:00 【No bug is the biggest bug】
public static void main(String[] args) throws Exception {
// Create an execution environment
StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
// Set parallelism
env.setParallelism(1);
// Read data source
DataStreamSource<Event> dataStream = env.fromElements(
new Event("Bob", "./cart", 1000L),
new Event("Bob", "./cart", 1000L),
new Event("Bob", "./cart/asdf", 1000L));
SingleOutputStreamOperator<Integer> map = dataStream.map(new RichMapFunction<Event, Integer>() {
@Override
public void open(Configuration parameters) throws Exception {
super.open(parameters);
System.out.println("open The lifecycle is called : " + getRuntimeContext().getIndexOfThisSubtask() + " Task No. 1 starts ");
}
@Override
public Integer map(Event event) throws Exception {
return event.url.length();
}
@Override
public void close() throws Exception {
super.close();
System.out.println("close The lifecycle is called : " + getRuntimeContext().getIndexOfThisSubtask() + " End of task No ");
}
});
// Print
map.print();
// Start
env.execute();
}边栏推荐
- 10. 509 Certificate (structure + principle)
- Openlayers ol ext: Transform object, rotate, stretch, zoom in
- How does Jupiter notebook change themes and font sizes?
- [kaggle] how to effectively avoid oom and the long process of alchemy
- Secondary vocational network security skills competition P100 dcore (light CMS system) SQL injection
- Use go language to import Doris data through stream load
- mysql_ Record the executed SQL
- Experience sharing of system architecture designers in preparing for the exam: how to prepare for the exam effectively
- Question D: pruning shrubs
- Riotboard development board series notes (6) -- buildreoot building system image
猜你喜欢

C language_ Defining structures and using variables
![[leetcode medium] 34. Find the first and last positions of elements in the sorted array - array double pointer](/img/f0/e572fe077ddd51b9c160e3382b2a07.png)
[leetcode medium] 34. Find the first and last positions of elements in the sorted array - array double pointer

B. Almost Ternary Matrix

Use of stm32cubemonitor Part II - historical data storage and network access

A 20 yuan facial cleanser sold tens of thousands in seven days. How did they do it?

Acwing 870. approximate number

Stm32cubemx quadrature encoder

Define macros in makefile and pass them to source code

P100 MSSQL database penetration test of secondary vocational network security skills competition

Force deduction brush question 7. Integer inversion
随机推荐
Unity: test rotation function
Secondary vocational network security skills competition P100 dcore (light CMS system) SQL injection
Easyexcel sets the style of the last row [which can be expanded to each row]
Sword finger offer II 041. Average value of sliding window_____ Using queue / loop array implementation
Electronic bidding procurement mall system: optimize traditional procurement business and speed up enterprise digital upgrading
How is the virtual DOM different from the actual DOM?
Reasons for not sending requests after uni app packaging
Performance test indicators using JMeter
Moveit2 - 10.urdf and SRDF
Force the resumption of game 302 of the week
Many local and municipal supervision departments carried out cold drink sampling inspection, and Zhong Xue's high-quality products were all qualified
File permission management
292. Nim game
mysql_ Case insensitive
LeetCode. 302 weekly games___ 03_ 6121. Query the number smaller than k after cutting the number____ sort
Riotboard development board series notes (V) -- porting u-boot
Force deduction brush question 14. Longest common prefix
NC | progress has been made in the study of the ecological network relationship between dissolved organic carbon and microorganisms in the context of global change
FLASH read / write problem of stm32cubemx
How to use two queues to simulate the implementation of a stack