I'm learning the Apache Flink. Here is the Hello World of Flink: https://ci.apache.org/projects/flink/flink-docs-stable/getting-started/tutorials/local_setup.html
This example is a program, which counts the words in every 5 seconds.
If we want to run this sample, we need to do the following steps:
- Execute
nc -l 9000
on one terminal (A); - Execute
./bin/flink run examples/streaming/SocketWindowWordCount.jar --port 9000
on another terminal (B); - Go to the terminal A and type some words.
If we Ctrl-c
on the terminal A, this sample will be terminated.
I want to know if it is possible to type the words programmatically at the terminal A. For example, I want to type the word lol
per second at the terminal A, what should I do?
The code below won't work.
#!/bin/bash
while true; do
echo 'lol' | nc -l 9000
sleep 1
done
Of course, I may try to modify the SocketWindowWordCount.java
to do so but for now, for some reason, I can not change the java code.