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

Popular posts from this blog

Django REST Framework perform_create: You cannot call `.save()` after accessing `serializer.data` -

Why does Go error when trying to marshal this JSON? -