withSparkStreaming
Wrapper for spark streaming creation. spark: SparkSession
and ssc: JavaStreamingContext
are provided, started, awaited, and stopped automatically. The use of a checkpoint directory is optional. If checkpoint data exists in the provided checkpointPath
, then StreamingContext will be recreated from the checkpoint data. If the data does not exist, then the provided factory will be used to create a JavaStreamingContext.
Parameters
The time interval at which streaming data will be divided into batches. Defaults to 1 second.
If checkpoint data exists in the provided checkpointPath
, then StreamingContext will be recreated from the checkpoint data. If the data does not exist (or null
is provided), then the streaming context will be built using the other provided parameters.
Only used if checkpointPath is given. Hadoop configuration if necessary for reading from any HDFS compatible file system.
Only used if checkpointPath is given. Whether to create a new JavaStreamingContext if there is an error in reading checkpoint data.
Spark options, value types are runtime-checked for type-correctness.
Sets the Spark master URL to connect to, such as "local" to run locally, "local4" to run locally with 4 cores, or "spark://master:7077" to run on a Spark standalone cluster. By default, it tries to get the system value "spark.master", otherwise it uses "local*".
Sets a name for the application, which will be shown in the Spark web UI. If no application name is set, a randomly generated name will be used.
The time in milliseconds to wait for the stream to terminate without input. -1 by default, this means no timeout.
Defaults to true
. If set to false
, then the streaming context will not be started.
Function which will be executed in context of KSparkStreamingSession (it means that this
inside block will point to KSparkStreamingSession)