How flink initializes spring

I have a few questions about using flink, just now. I would like to ask all of you to help me.
  1. flink how to initialize spring context
  2. flink how to use scheduled tasks

@ codecraft @ Ali Yunqi Community @ Fan Xuan Thank you

Jan.08,2022

for question 1:
1, the basic principle is to load the context, of spring before execution in order to avoid repeated reconstruction, you can use the simple interest mode
2. For source, sink and transformation, you can use the relevant function, that inherits AbstractRichFunction to initialize spring context
3. For the destruction of spring context, register a shutdown hook to destroy

.

for problem 2:
see how to use timed tasks. If you only need to be similar to schedule, in ordinary spring, then problem 1 can be solved. If you want to do timing in source or sink, you probably have to implement it according to your own requirements, such as using cron4j

.

http://www.54tianzhisheng.cn/.

there are also many good Flink blogs here, which are worth recommending!

the corresponding code repository is located in https://github.com/zhisheng17.

.
Menu