Package org.apache.spark.sql.streaming
Class StreamingQueryListener
Object
org.apache.spark.sql.streaming.StreamingQueryListener
- All Implemented Interfaces:
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
Nested ClassesModifier and TypeClassDescriptionstatic interfaceBase type ofStreamingQueryListenereventsstatic classEvent representing that query is idle and waiting for new data to process.static classstatic classEvent representing any progress updates in a query.static classstatic classEvent representing the start of a query param: id A unique query id that persists across restarts.static classstatic classEvent representing that termination of a query.static class -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidCalled when the query is idle and waiting for new data to process.abstract voidCalled when there is some status update (ingestion rate updated, etc.)abstract voidCalled when a query is started.abstract voidCalled 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
DataStreamWriter.start(), that is,onQueryStartwill 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
StreamingQuerywill always be latest no matter when this method is called. Therefore, the status ofStreamingQuerymay be changed before/when you process the event. E.g., you may findStreamingQueryis 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
-