public class StreamingWordCount implements Serializable { public static void main(String[] args) { JavaStreamingContext jssc = new JavaStreamingContext("local[2]", "JavaWordCount", new Duration(1000)); JavaDStream<String> data = jssc.textFileStream("D:/krishna/").cache(); data.foreach(new Function<JavaRDD<String>, Void>() { public Void call(JavaRDD<String> rdd) throws Exception { List<String> output = rdd.collect(); System.out.println("Sentences Collected from files " + output); return null; } }); data.print(); jssc.start(); jssc.awaitTermination(); } }
I use Spark standalone in Windows 8.
Does JavaStreamingContext support only HDFS directories?
Click to display: This is displayed on the console, Sentence, assembled from files, is empty. I tried changing the directory files. But still, the code does not collect files. This is my first code in Spark Streaming. Please help.
5 10 , - , , jssc.awaitTermination() .
Source: https://habr.com/ru/post/1614868/More articles:Determining if an attribute is valid in standard HTML (or SVG) - javascriptBootstrap 3 Datepicker - Knockout.js - twitter-bootstraprem units do not work in webview - androidAndroid Webview rem единиц масштабируется до больших для ящиков - androidFix TCP port using WindowsAzure.Storage in .NET 5.0 - c #Is size_t always unsigned int - c ++How to solve this dynamic programming? - algorithmHow to get React Component link to change my class using classList? - javascriptКак я могу сохранить дерево 2 - 3 ГБ в памяти и сделать его доступным для nodejs? - jsonHow to read a string in tcp-juice in Swift - iosAll Articles