Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
spark
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cs525-sp18-g07
spark
Commits
a2346219
Commit
a2346219
authored
12 years ago
by
Denny
Browse files
Options
Downloads
Patches
Plain Diff
Adjust Kafka code to work with new streaming changes.
parent
15df4b0e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
streaming/src/main/scala/spark/streaming/DStream.scala
+2
-2
2 additions, 2 deletions
streaming/src/main/scala/spark/streaming/DStream.scala
streaming/src/main/scala/spark/streaming/examples/KafkaWordCount.scala
+3
-2
3 additions, 2 deletions
.../main/scala/spark/streaming/examples/KafkaWordCount.scala
with
5 additions
and
4 deletions
streaming/src/main/scala/spark/streaming/DStream.scala
+
2
−
2
View file @
a2346219
...
...
@@ -365,8 +365,8 @@ extends Serializable with Logging {
}
}
}
logInfo
(
"Updated checkpoint data for time "
+
currentTime
+
", "
+
checkpointData
.
size
+
" checkpoints, "
+
"["
+
checkpointData
.
mkString
(
","
)
+
"]"
)
logInfo
(
"Updated checkpoint data for time "
+
currentTime
+
", "
+
checkpointData
.
rdds
.
size
+
" checkpoints, "
+
"["
+
checkpointData
.
rdds
.
mkString
(
","
)
+
"]"
)
}
/**
...
...
This diff is collapsed.
Click to expand it.
streaming/src/main/scala/spark/streaming/examples/KafkaWordCount.scala
+
3
−
2
View file @
a2346219
...
...
@@ -4,6 +4,7 @@ import java.util.Properties
import
kafka.message.Message
import
kafka.producer.SyncProducerConfig
import
kafka.producer._
import
spark.SparkContext
import
spark.streaming._
import
spark.streaming.StreamingContext._
import
spark.storage.StorageLevel
...
...
@@ -19,9 +20,9 @@ object KafkaWordCount {
val
Array
(
master
,
hostname
,
port
,
group
,
topics
,
numThreads
)
=
args
val
ssc
=
new
StreamingContext
(
master
,
"KafkaWordCount"
)
val
sc
=
new
SparkContext
(
master
,
"KafkaWordCount"
)
val
ssc
=
new
StreamingContext
(
sc
,
Seconds
(
2
))
ssc
.
checkpoint
(
"checkpoint"
)
ssc
.
setBatchDuration
(
Seconds
(
2
))
val
topicpMap
=
topics
.
split
(
","
).
map
((
_
,
numThreads
.
toInt
)).
toMap
val
lines
=
ssc
.
kafkaStream
[
String
](
hostname
,
port
.
toInt
,
group
,
topicpMap
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment