@@ -0,0 +1,2133 @@
+/*%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A *  http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0Apackage tw.flink.jcconf2016.streaming.wordcount;%0A%0Aimport org.apache.flink.api.common.functions.FlatMapFunction;%0Aimport org.apache.flink.api.java.tuple.Tuple2;%0Aimport org.apache.flink.streaming.api.datastream.DataStream;%0Aimport org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;%0Aimport org.apache.flink.streaming.api.windowing.time.Time;%0Aimport org.apache.flink.util.Collector;%0A%0A/**%0A * Basic streaming word count example, that reads text lines from a socket stream%0A */%0Apublic class StreamingWordCount %7B%0A%0A%09public static void main(String%5B%5D args) throws Exception %7B%0A%0A%09%09final StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();%0A%0A%09%09DataStream%3CTuple2%3CString,Integer%3E%3E counts = env%0A%09%09%09%09// read stream of words from socket%0A%09%09%09%09.socketTextStream(%22localhost%22, 1234)%0A%09%09%09%09// split up the lines into tuple: (word, 1)%0A%09%09%09%09.flatMap(new LineSplitter())%0A%09%09%09%09// use the %E2%80%9Cword%E2%80%9D as key%0A%09%09%09%09.keyBy(0)%0A%09%09%09%09// compute counts every 10 seconds%0A%09%09%09%09.timeWindow(Time.seconds(10))%0A%09%09%09%09// sum up the values%0A%09%09%09%09.sum(1);%0A%0A%09%09// print result to console%0A%09%09counts.print();%0A%09%09// execute program%0A%09%09env.execute(%22Socket Word Count Example%22);%0A%09%7D%0A%0A%09public static class LineSplitter implements FlatMapFunction%3CString, Tuple2%3CString,Integer%3E%3E %7B%0A%0A%09%09@Override%0A%09%09public void flatMap(String value, Collector%3CTuple2%3CString,Integer%3E%3E out) throws Exception %7B%0A%09%09%09// normalize and split lines%0A%09%09%09String%5B%5D words = value.toLowerCase().split(%22%5C%5CW+%22);%0A%09%09%09for (String word : words) %7B%0A%09%09%09%09if (word.length() %3E 0) %7B%0A%09%09%09%09%09out.collect(new Tuple2%3C%3E(word, 1));%0A%09%09%09%09%7D%0A%09%09%09%7D%0A%09%09%7D%0A%0A%09%7D%0A%0A%7D%0A

Add basic streaming wordcount example