[DOCS] fix example code issues in documentation
## What changes were proposed in this pull request? Fixed broken java code examples in streaming documentation Attn: tdas Author: Matthew Wise <matthew.rs.wise@gmail.com> Closes #13388 from mawise/fix_docs_java_streaming_example.
This commit is contained in:
parent
5728aa558e
commit
2d34183b27
|
@ -111,7 +111,7 @@ Next, we discuss how to use this approach in your streaming application.
|
||||||
<div data-lang="java" markdown="1">
|
<div data-lang="java" markdown="1">
|
||||||
import org.apache.spark.streaming.kafka.*;
|
import org.apache.spark.streaming.kafka.*;
|
||||||
|
|
||||||
JavaPairReceiverInputDStream<String, String> directKafkaStream =
|
JavaPairInputDStream<String, String> directKafkaStream =
|
||||||
KafkaUtils.createDirectStream(streamingContext,
|
KafkaUtils.createDirectStream(streamingContext,
|
||||||
[key class], [value class], [key decoder class], [value decoder class],
|
[key class], [value class], [key decoder class], [value decoder class],
|
||||||
[map of Kafka parameters], [set of topics to consume]);
|
[map of Kafka parameters], [set of topics to consume]);
|
||||||
|
|
|
@ -145,8 +145,8 @@ import org.apache.spark.streaming.api.java.*;
|
||||||
import scala.Tuple2;
|
import scala.Tuple2;
|
||||||
|
|
||||||
// Create a local StreamingContext with two working thread and batch interval of 1 second
|
// Create a local StreamingContext with two working thread and batch interval of 1 second
|
||||||
SparkConf conf = new SparkConf().setMaster("local[2]").setAppName("NetworkWordCount")
|
SparkConf conf = new SparkConf().setMaster("local[2]").setAppName("NetworkWordCount");
|
||||||
JavaStreamingContext jssc = new JavaStreamingContext(conf, Durations.seconds(1))
|
JavaStreamingContext jssc = new JavaStreamingContext(conf, Durations.seconds(1));
|
||||||
{% endhighlight %}
|
{% endhighlight %}
|
||||||
|
|
||||||
Using this context, we can create a DStream that represents streaming data from a TCP
|
Using this context, we can create a DStream that represents streaming data from a TCP
|
||||||
|
|
Loading…
Reference in a new issue