Git Product home page Git Product logo

flink-streaming-spring-boot's Introduction

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.

flink-streaming-spring-boot's People

Stargazers

PEP 8 Speaks avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.