

Spark processing pipeline, includes two main components as SparkStreaming and Spark Engine. Internally it can be illustrated as below. SparkStreaming for Scalable, Fault Tolerant, Efficient Stream Data ProcessingĪpache spark comes with high level abstractions for reading streamed data from various sources, semantics to maintain the fault tolerance in data processing and finally support for integrating results with various data storages. This internally generates a SparkContext (referred from streaming ContextObject, spark Contest ),which initializes all Spark functionalities. The second argument for creating the StreamingContext object is the batch interval (about which we will see the details in next section) Val streamingContextObject= new StreamingContext(configurations, Seconds(2)) SparkConf().setAppName(applicationName).setMaster(masterURL) StreamingContext object is initialized as below: This waiting is done by calling the function, awaitTermination on the same object. Wait until the processing ends either due to an error or by calling the function stop() on initialized StreamingContext object. Receive data and process them by calling start() method on the initialized, StreamingContext object.Ĥ. Apply transformations and output operations to DStream to define the necessary computations.ģ. Create input DStreams to define sources of input.Ģ. Once initialized, the normal flow of the application will be:ġ. The first step in any Spark Streaming application is to initialize a StreamingContext object from the SparkConf object. the relevant libraries to handle the data receipt and buffering, should be added accordingly.

LibraryDependencies += “” % “spark-streaming_2.12” % “1.3.1” If the application will be reading input from external source like Kafka, twitter, etc. Before writing any Spark Streaming application, dependencies should be configured in Maven project as below. Data storage systems could be a database, a filesystem (like HDFS) or a dashboard even.ĭevelopment and Deployment Considerationsīefore moving into the SparkStreaming API details, let us see about its dependency linking and StamingContextAPI which is the entry point to any application with SparkStreaming.īoth Spark and Spark Streaming can be imported from the Maven Repository. Storing Data: The generated results data should be stored for consumption.Algorithms supported by Spark can be effectively used in this step for complex tasks such as machine learning and graph processing as well. Processing Data: The captured data should be cleaned, necessary information should be extracted and transformed into results.Data could be coming from sources like Twitter, Kaffka or TCPSockets, etc. Ingesting Data: Streamed data should be received and buffered, before processing.Three main steps are included in the pipeline of stream data processing: Develop Your Skills on the Apache Spark Training at Mindmajix.
