SparkStreaming中常常遇到需要监控每个批次的运行情况,当出现不正常的情况需要及时反馈。就需要用到org.apache.spark.streaming.scheduler.StreamingListener这个类来进行处理。
一下为其源码部分
/**
* :: DeveloperApi ::
* A listener interface for receiving information about an ongoing streaming
* computation.
*/
@DeveloperApi
trait StreamingListener {
/** Called when the streaming has been started */
def onStreamingStarted(streamingStarted: StreamingListenerStreamingStarted) { }
/** Called when a receiver has been started */
def onReceiverStarted(receiverStarted: StreamingListenerReceiverStarted) { }
/** Called when a receiver has reported an error */
def onReceiverError(receiverError: StreamingListenerReceiverError) { }
/** Called when a receiver has been stopped */
def onReceiverStopped(receiverStopped: StreamingListenerReceiverStopped) { }
/** Called when a batch of jobs has been submitted for processing. */
def onBatchSubmitted(batchSubmitted: Streami