Shashi
Shashi

Reputation: 2714

StreamingContext does not have a constructor

I am dealing very basic Spark Streaming Scala code . Code is Given below

import org.apache.spark.streaming._
import org.apache.spark.streaming.StreamingContext
import org.apache.spark.streaming.StreamingContext._
import org.apache.spark.storage.StorageLevel
import org.apache.spark.SparkConf
object TestStreamProcessor {

    def main(args: Array [String]) {

            val batchInterval = 5

                val sparkConfig = new SparkConf().setAppName("TestKinesisConsumer")
                val ssc = new StreamingContext(sparkConfig, batchInterval)
            ssc.start()
                ssc.awaitTerminationOrTimeout(batchIntervalSeconds * 5 * 1000)


    }
}

But getting below Error while building code using maven.

 error: org.apache.spark.streaming.StreamingContext does not have a constructor
[INFO]              val ssc = new StreamingContext(sparkConfig, batchInterval)

Did anyone faced this before ?

Upvotes: 0

Views: 221

Answers (1)

SergGr
SergGr

Reputation: 23788

So what exactly is your question? If you open the docs you can see that the batchDuration argument is of type org.apache.spark.streaming.Duration. Have you tried something like

val ssc = new StreamingContext(sparkConfig, Seconds(batchInterval))

Upvotes: 2

Related Questions