Spark 2.0 simplified the API for Streaming and lets us to access stream data in form of DataFrame and DataSet. Hence with new architecture we can process our streamed data according to our business logic with DataFrame. This is the simple concept behind above architecture.

So here we have two approach to use Spark Streaming programmetically :