scala - how to use spark streaming + kafka with streamingListener -
i have 1 situation here.
i want aplication connect 1 time kafka, read offset, make action , stop application.
i reading streaminglistener detect when first iteration occurs.
i don´t know how use streaminglistener stop mi application. can me?
i using spark 1.4
example code bellow:
val lines = kafkautils.createstream(ssc, zkquorum, group, topicmap).map(_._2) lines.foreachrdd( rdd => { rdd.saveastextfile("......") }) sys.shutdownhookthread { println("gracefully stopping spark streaming application") ssc.stop(true, true) println("application stopped") } ssc.start() ssc.awaittermination()
thanks!
Comments
Post a Comment