I am looking for the simplest possible example of an hello-world experience with Apache flink.
Assume I have just installed flink on a clean box, what is the bare minimum I would need to do to 'make it do something'. I realize this is quite vague, here are some examples.
Three python examples from the terminal:
python -c "print('hello world')"
python hello_world.py
python python -c "print(1+1)"
Of course a streaming application is a bit more complicated, but here is something similar that I did for spark streaming earlier:
https://spark.apache.org/docs/latest/streaming-programming-guide.html#a-quick-example
As you see these examples have some nice properties:
So my question:
What I found so far are examples with 50 lines of code that you need to compile.
If this cannot be avoided due to point 3, then something that satisfies points 1 and 2 and uses (only) jars that are shipped by default, or easily available from a reputable source, would also be fine.
Ok, how about this:
public static void main(String[] args) throws Exception {
final StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
env.fromElements(1, 2, 3, 4, 5)
.map(i -> 2 * i)
.print();
env.execute();
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With