onQueryStarted(
event: QueryStartedEvent): Unit
StreamingQueryListener — Intercepting Life Cycle Events of Streaming Queries
StreamingQueryListener
is the contract of listeners that want to be notified about the life cycle events of streaming queries, i.e. start, progress and termination.
Method | Description |
---|---|
|
Informs that |
|
Informs that |
|
Informs that a streaming query was stopped or terminated due to an error |
StreamingQueryListener
is informed about the life cycle events when StreamingQueryListenerBus
is requested to doPostEvent.
Event | Callback | Description |
---|---|---|
Posted when |
||
QueryProgressEvent |
Posted when |
|
Posted when |
You can register a StreamingQueryListener
using StreamingQueryManager.addListener method.
val queryListener: StreamingQueryListener = ...
spark.streams.addListener(queryListener)
You can remove a StreamingQueryListener
using StreamingQueryManager.removeListener method.
val queryListener: StreamingQueryListener = ...
spark.streams.removeListener(queryListener)
Note
|
onQueryStarted is used internally to unblock the starting thread of StreamExecution .
|
Note
|
You can also register a streaming event listener using the general Read up on SparkListener in the The Internals of Apache Spark book. |