1 Star 1 Fork 0

孟凡霄 / Flink-Streaming-Spring-Boot

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

Flink Streaming Spring Boot

The application submits a Flink job via Flink's remote environment. The job is submitted once the spring boot server starts up.

How to run

See com.tenble.flink.streaming.springboot.FlinkStreamingSpringBootTest as an example.

  1. Import this project as a dependency for another project.
  2. Add @EnableAutoConfigure to your spring boot app.
  3. During spring's context loading phase, autowire the bean StreamExecutionEnvironment flinkEnvironment in another bean and add operations to the environment.
  4. Copy the shade plugin step in pom.xml of this project to create an executable spring boot jar. See <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer" /> to specify a mainClass.
  5. Run mvn clean package on your project, which will create an executable spring boot application, with all dependencies put onto the classpath. Can be found in the target directory.
  6. Run this jar using java -jar ${JAR_FILE}. Specify any spring property overrides as jvm or program arguments.

Properties

flink-properties:
  job-name: "FlinkStreamingSpringBoot"                              # flink job name
  job-manager-url: "localhost"                                      # hostname for the flink job manager
  job-manager-port: 8081                                            # REST port of the flink job manager
  remote-env-jar-files:                                             # any jars to upload to the flink job manager alongside your job
    - "target/flink-streaming-spring-boot-0.0.1-SNAPSHOT.jar"
  max-client-rest-request-size-bytes: 2000000000                    # maximum job size for the REST request to restrict on the client in bytes
  terminate: true                                                   # terminate application after the allocated time has passed
  termination-grace-period-ms: 120000                               # amount of time to wait before this spring boot application terminates

Kubernetes files

The files in the folder k8s/ are slightly modified files from Flink's Kubernetes Setup page. They have been modified to increase the maximum allowable rest request size.

Caveats

  1. Java API for Flink does not have an option to use detached mode, which is why the termination-grace-period-ms is necessary.
MIT License Copyright (c) 2018 Benjamin Lee Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

暂无描述 展开 收起
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
1
https://gitee.com/pingfanrenbiji/Flink-Streaming-Spring-Boot.git
git@gitee.com:pingfanrenbiji/Flink-Streaming-Spring-Boot.git
pingfanrenbiji
Flink-Streaming-Spring-Boot
Flink-Streaming-Spring-Boot
master

搜索帮助