flink README

The project's README from github.com/apache/flink. As one markdown file: README.md.

Apache Flink

Apache Flink is an open source stream processing framework with powerful stream- and batch-processing capabilities.

Learn more about Flink at https://flink.apache.org/

Features

Streaming Example

// pojo class WordWithCount
public class WordWithCount {
    public String word;
    public int count;

    public WordWithCount() {}
    
    public WordWithCount(String word, int count) {
        this.word = word;
        this.count = count;
    }
}

// main method
StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
DataStreamSource<String> text = env.socketTextStream(host, port);
DataStream<WordWithCount> windowCounts = text
    .flatMap(
        (FlatMapFunction<String, String>) (line, collector) 
            -> Arrays.stream(line.split("\\s")).forEach(collector::collect)
    ).returns(String.class)
    .map(word -> new WordWithCount(word, 1)).returns(TypeInformation.of(WordWithCount.class))
    .keyBy(wordWithCnt -> wordWithCnt.word)
    .window(TumblingProcessingTimeWindows.of(Duration.ofSeconds(5)))
    .sum("count").returns(TypeInformation.of(WordWithCount.class));

windowCounts.print();
env.execute();
}

Batch Example

// pojo class WordWithCount
public class WordWithCount {
    public String word;
    public int count;

    public WordWithCount() {}

    public WordWithCount(String word, int count) {
        this.word = word;
        this.count = count;
    }
}

// main method
StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
env.setRuntimeMode(RuntimeExecutionMode.BATCH);
FileSource<String> source = FileSource.forRecordStreamFormat(new TextLineInputFormat(), new Path("MyInput.txt")).build();
DataStreamSource<String> text = env.fromSource(source, WatermarkStrategy.noWatermarks(), "MySource");
DataStream<WordWithCount> windowCounts = text
        .flatMap((FlatMapFunction<String, String>) (line, collector) -> Arrays
                .stream(line.split("\\s"))
                .forEach(collector::collect)).returns(String.class)
        .map(word -> new WordWithCount(word, 1)).returns(TypeInformation.of(WordWithCount.class))
        .keyBy(wordWithCount -> wordWithCount.word)
        .sum("count").returns(TypeInformation.of(WordWithCount.class));

windowCounts.print();
env.execute();

Prerequisites for building Flink:

Basic Build Instructions

First, clone the repository:

git clone https://github.com/apache/flink.git
cd flink

Then, choose one of the following commands based on your preferred Java version:

For Java 11

./mvnw clean package -DskipTests -Djdk11 -Pjava11-target

For Java 17 (Default)

./mvnw clean package -DskipTests -Djdk17 -Pjava17-target

For Java 21

./mvnw clean package -DskipTests -Djdk21 -Pjava21-target

The build process will take approximately 10 minutes to complete. Flink will be installed in build-target.

Notes

The Flink committers use IntelliJ IDEA to develop the Flink codebase. We recommend IntelliJ IDEA for developing projects that involve Scala code.

Minimal requirements for an IDE are:

IntelliJ IDEA

The IntelliJ IDE supports Maven out of the box and offers a plugin for Scala development.

Check out our DEVELOPMENT.md guide for detailed IDE setup instructions.

Eclipse Scala IDE

NOTE: From our experience, this setup does not work with Flink due to deficiencies of the old Eclipse version bundled with Scala IDE 3.0.3 or due to version incompatibilities with the bundled Scala version in Scala IDE 4.4.1.

We recommend to use IntelliJ instead (see above)

Support

Don’t hesitate to ask!

Contact the developers and community on the mailing lists if you need any help.

Open an issue if you find a bug in Flink.

Documentation

The documentation of Apache Flink is located on the website: https://flink.apache.org or in the docs/ directory of the source code.

Fork and Contribute

This is an active open-source project. We are always open to people who want to use the system or contribute to it. Contact us if you are looking for implementation tasks that fit your skills. This article describes how to contribute to Apache Flink.

Externalized Connectors

Most Flink connectors have been externalized to individual repos under the Apache Software Foundation:

About

Apache Flink is an open source project of The Apache Software Foundation (ASF). The Apache Flink project originated from the Stratosphere research project.

flink (apache/flink)

Searching Database…

26.4K ·GitHub
What is this?Apache Flink is an open source stream processing framework with powerful stream- and batch-processing capabilities, running your programs on its own distributed runtime.
Is this a library I add to my app, or a system I deploy and run programs on?It is a framework, not a library: your Java programs run on Flink's streaming-first runtime, typically deployed in a cluster alongside Hadoop components like YARN, HDFS and HBase.
How do I get it up and running?Clone the repo and run the Maven wrapper build command for your Java version: it takes about 10 minutes and Flink is installed in build-target. Full documentation lives on the project website.
What do I need installed before I build it?A Unix-like environment (Linux, Mac OS X, Cygwin or WSL), Git and Java 11, 17 or 21. Maven 3.9.16 is required, but the bundled mvnw wrapper makes sure the correct version is used.
Anything tricky about the build?JAVA_HOME must point to the JDK matching your chosen Java version, and each version needs its own Maven profile and -Djdk flag. The README suggests -DskipTests to speed up the build.
How does it connect to Kafka, databases and other systems?Via separate connector repos under the Apache Software Foundation: flink-connector-kafka, flink-connector-jdbc, plus connectors for Elasticsearch, Cassandra, MongoDB, Pulsar, RabbitMQ and more.
What does streaming-first mean in practice?Event time and out-of-order processing in the DataStream API, flexible windowing (time, count, sessions, custom triggers), exactly-once fault tolerance and low event latency with natural back-pressure.
What libraries come with it beyond the core APIs?There are libraries for graph processing (batch), machine learning (batch) and complex event processing (streaming), plus custom memory management for switching between in-memory and out-of-core processing.
Where did Flink come from?It originated from the Stratosphere research project and is now an Apache Software Foundation project; the team develops it in IntelliJ IDEA, with IDE setup described in DEVELOPMENT.md.
Creator
apache
Size
544 MB
Stars
26.4K
Updated
CommitOct 16
Age
12y
Commits · 90 Days