File tree 3 files changed +8
-3
lines changed
src/main/scala/org/mkuthan/spark
3 files changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -48,11 +48,11 @@ Start Kafka producer:
48
48
49
49
Start Kafka consumer:
50
50
51
- ./bin/kafka-console-consumer.sh --zookeeper localhost:2181 --topic output
51
+ ./bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic output
52
52
53
53
Run example application:
54
54
55
- ./ sbt "run-main example.WordCountJob"
55
+ sbt "runMain example.WordCountJob"
56
56
57
57
Publish a few words on input topic using Kafka console producer and check the processing result on output topic using Kafka console producer.
58
58
Original file line number Diff line number Diff line change @@ -57,6 +57,10 @@ lazy val customLibraryDependencies = Seq(
57
57
" org.scalatest" %% " scalatest" % " 2.2.4" % " test"
58
58
)
59
59
60
+ lazy val commonExcludeDependencies = Seq (
61
+ " org.slf4j" % " slf4j-log4j12"
62
+ )
63
+
60
64
lazy val customJavaOptions = Seq (
61
65
" -Xmx1024m" ,
62
66
" -XX:-MaxFDLimit"
@@ -69,6 +73,7 @@ lazy val root = (project in file("."))
69
73
.settings(commonSettings)
70
74
.settings(scalacOptions ++= customScalacOptions)
71
75
.settings(libraryDependencies ++= customLibraryDependencies)
76
+ .settings(excludeDependencies ++= commonExcludeDependencies)
72
77
.settings(fork in run := true )
73
78
.settings(connectInput in run := true )
74
79
.settings(javaOptions in run ++= customJavaOptions)
Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ import org.apache.log4j.Logger
23
23
import org .apache .spark .TaskContext
24
24
import org .apache .spark .streaming .dstream .DStream
25
25
26
- class KafkaDStreamSink (dstream : DStream [KafkaPayload ]) {
26
+ class KafkaDStreamSink (@ transient private val dstream : DStream [KafkaPayload ]) extends Serializable {
27
27
28
28
def sendToKafka (config : Map [String , String ], topic : String ): Unit = {
29
29
dstream.foreachRDD { rdd =>
You can’t perform that action at this time.
0 commit comments