Skip to content

Instantly share code, notes, and snippets.

@mslitao
Forked from maxtomassi/StopSparkStreaming.scala
Last active August 29, 2015 14:21
Show Gist options
  • Select an option

  • Save mslitao/574776a0ad5dac00547e to your computer and use it in GitHub Desktop.

Select an option

Save mslitao/574776a0ad5dac00547e to your computer and use it in GitHub Desktop.
def main(args: Array[String]) {
// Prepare your environment
val ssc = new StreamingContext(conf, Seconds(batchDurationInSec))
// Do your processing
sys.ShutdownHookThread {
log.info("Gracefully stopping Spark Streaming Application")
ssc.stop(true, true)
log.info("Application stopped")
}
ssc.start
ssc.awaitTermination
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment