-
Notifications
You must be signed in to change notification settings - Fork 0
/
Spark Streaming Example 2 - Kafka Access.json
1 lines (1 loc) · 3.31 KB
/
Spark Streaming Example 2 - Kafka Access.json
1
{"paragraphs":[{"title":"Required Dependencies","text":"%dep\n\nz.load(\"org.apache.spark:spark-streaming_2.10:jar:1.6.2\")\nz.load(\"org.apache.spark:spark-streaming-kafka_2.10:jar:1.6.2\")\nz.load(\"org.apache.kafka:kafka_2.10:jar:0.10.0.1\")\nz.load(\"com.yammer.metrics:metrics-core:jar:2.2.0\")\nz.load(\"com.101tec:zkclient:jar:0.9\")\n","dateUpdated":"2017-02-09T02:26:37-0500","config":{"colWidth":12,"editorMode":"ace/mode/scala","title":true,"graph":{"mode":"table","height":300,"optionOpen":false,"keys":[],"values":[],"groups":[],"scatter":{}},"enabled":true},"settings":{"params":{},"forms":{}},"jobName":"paragraph_1486668397349_-1159479408","id":"20160830-145728_362255206","result":{"code":"SUCCESS","type":"TEXT","msg":"res0: org.apache.zeppelin.dep.Dependency = org.apache.zeppelin.dep.Dependency@39fd82c8\n"},"dateCreated":"2017-02-09T02:26:37-0500","status":"READY","errorMessage":"","progressUpdateIntervalMs":500,"$$hashKey":"object:15461"},{"title":"Read from Kafka Topic using Direct Stream","text":"%spark\n\nimport org.apache.spark.streaming.{Seconds, StreamingContext}\nimport _root_.kafka.serializer.StringDecoder\nimport org.apache.spark.streaming.kafka.KafkaUtils\n \nval ssc = new StreamingContext(sc, Seconds(30))\n\nssc.checkpoint(\"c:/ie-training/tmp\")\n \nval kafkaParams = Map(\n \"metadata.broker.list\" -> \"localhost:9092\",\n \"auto.offset.reset\" -> \"smallest\"\n)\n \nval topics = Set(\"messages\")\n \nval messagesStream = KafkaUtils.createDirectStream[String, String, StringDecoder, StringDecoder](ssc, kafkaParams, topics).map(_._2)\n \nmessagesStream.print()\n\nssc.start \n","dateUpdated":"2017-02-09T02:26:37-0500","config":{"colWidth":12,"editorMode":"ace/mode/scala","editorHide":false,"title":true,"graph":{"mode":"table","height":300,"optionOpen":false,"keys":[],"values":[],"groups":[],"scatter":{}},"enabled":true},"settings":{"params":{},"forms":{}},"jobName":"paragraph_1486668397350_-1158325161","id":"20160830-170427_1816087646","dateCreated":"2017-02-09T02:26:37-0500","status":"READY","errorMessage":"","progressUpdateIntervalMs":500,"$$hashKey":"object:15462"},{"text":"%spark\n\nssc.stop(stopSparkContext=false, stopGracefully=true)\n","dateUpdated":"2017-02-09T02:26:37-0500","config":{"colWidth":12,"editorMode":"ace/mode/scala","graph":{"mode":"table","height":300,"optionOpen":false,"keys":[],"values":[],"groups":[],"scatter":{}},"enabled":true},"settings":{"params":{},"forms":{}},"jobName":"paragraph_1486668397350_-1158325161","id":"20160830-170845_1145510546","result":{"code":"SUCCESS","type":"TEXT","msg":""},"dateCreated":"2017-02-09T02:26:37-0500","status":"READY","errorMessage":"","progressUpdateIntervalMs":500,"$$hashKey":"object:15463"},{"dateUpdated":"2017-02-09T02:26:37-0500","config":{"colWidth":12,"editorMode":"ace/mode/scala","graph":{"mode":"table","height":300,"optionOpen":false,"keys":[],"values":[],"groups":[],"scatter":{}},"enabled":true},"settings":{"params":{},"forms":{}},"jobName":"paragraph_1486668397350_-1158325161","id":"20160830-165856_475845132","dateCreated":"2017-02-09T02:26:37-0500","status":"READY","errorMessage":"","progressUpdateIntervalMs":500,"$$hashKey":"object:15464"}],"name":"Spark Streaming Example 2 - Kafka Access","id":"2CBJF8GBN","angularObjects":{"2C14DCYPT:shared_process":[],"2BXE9YPBX:shared_process":[]},"config":{"looknfeel":"default"},"info":{}}