Class StreamingQueryListener

Object
org.apache.spark.sql.streaming.StreamingQueryListener
All Implemented Interfaces:
Serializable, scala.Serializable

public abstract class StreamingQueryListener extends Object implements 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.

  • Constructor Details

    • StreamingQueryListener

      public StreamingQueryListener()
  • Method Details

    • onQueryStarted

      public abstract void onQueryStarted(StreamingQueryListener.QueryStartedEvent event)
      Called when a query is started.
      Parameters:
      event - (undocumented)
      Since:
      2.0.0
      Note:
      This is called synchronously with DataStreamWriter.start(), that is, onQueryStart will be called on all listeners before DataStreamWriter.start() returns the corresponding StreamingQuery. Please don't block this method as it will block your query.
    • onQueryProgress

      public abstract void onQueryProgress(StreamingQueryListener.QueryProgressEvent event)
      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 of StreamingQuery may be changed before/when you process the event. E.g., you may find StreamingQuery is terminated when you are processing QueryProgressEvent.
    • onQueryIdle

      public void onQueryIdle(StreamingQueryListener.QueryIdleEvent event)
      Called when the query is idle and waiting for new data to process.
      Parameters:
      event - (undocumented)
      Since:
      3.5.0
    • onQueryTerminated

      public abstract void onQueryTerminated(StreamingQueryListener.QueryTerminatedEvent event)
      Called when a query is stopped, with or without error.
      Parameters:
      event - (undocumented)
      Since:
      2.0.0