Package org.apache.spark.sql.streaming
Class StreamingQueryListener
Object
org.apache.spark.sql.streaming.StreamingQueryListener
- All Implemented Interfaces:
Serializable
,scala.Serializable
Interface for listening to events related to
StreamingQueries
.- Since:
- 2.0.0
- See Also:
- Note:
- The methods are not thread-safe as they may be called from different threads.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
Base type ofStreamingQueryListener
eventsstatic class
Event representing that query is idle and waiting for new data to process.static class
Event representing any progress updates in a query.static class
Event representing the start of a query param: id A unique query id that persists across restarts.static class
Event representing that termination of a query. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Called when the query is idle and waiting for new data to process.abstract void
Called when there is some status update (ingestion rate updated, etc.)abstract void
Called when a query is started.abstract void
Called when a query is stopped, with or without error.
-
Constructor Details
-
StreamingQueryListener
public StreamingQueryListener()
-
-
Method Details
-
onQueryStarted
Called when a query is started.- Parameters:
event
- (undocumented)- Since:
- 2.0.0
- Note:
- This is called synchronously with
, that is,DataStreamWriter.start()
onQueryStart
will be called on all listeners beforeDataStreamWriter.start()
returns the correspondingStreamingQuery
. Please don't block this method as it will block your query.
-
onQueryProgress
Called when there is some status update (ingestion rate updated, etc.)- Parameters:
event
- (undocumented)- Since:
- 2.0.0
- Note:
- This method is asynchronous. The status in
StreamingQuery
will always be latest no matter when this method is called. Therefore, the status ofStreamingQuery
may be changed before/when you process the event. E.g., you may findStreamingQuery
is terminated when you are processingQueryProgressEvent
.
-
onQueryIdle
Called when the query is idle and waiting for new data to process.- Parameters:
event
- (undocumented)- Since:
- 3.5.0
-
onQueryTerminated
Called when a query is stopped, with or without error.- Parameters:
event
- (undocumented)- Since:
- 2.0.0
-