I'm a beginner in spark streaming. I'm producing and consuming messages using spark streaming. But I cannot stop the consumer . Actually I need to stop the streaming when the producer sends no message. Could somebody help me on that with java code. If possible give me a small example codes to stop the streaming on java.
I'm using spark version 2.2.0
conf.set("spark.streaming.stopGracefullyOnShutdown","true");
// Execute the Spark workflow defined above
streamingContext.start();
try {
streamingContext.awaitTermination();
} catch (Exception e) {
// e.printStackTrace();
}