Skip to content

StreamingQueryManager

Defined in: streaming/streaming-query-manager.ts:36

Manages the streaming queries on a SparkSession. Obtained via spark.streams. Mirrors pyspark.sql.streaming.StreamingQueryManager and the canonical Scala StreamingQueryManager.

Spark source: StreamingQueryManager.scala

active(): Promise<StreamingQuery[]>;

Defined in: streaming/streaming-query-manager.ts:45

All currently-active streaming queries on this session.

Promise<StreamingQuery[]>


addListener(listener): Promise<void>;

Defined in: streaming/streaming-query-manager.ts:118

Register listener on the streaming-query event bus. The first call opens a server-side subscription; subsequent listeners share it. Resolves once the server acknowledges registration.

Parameter Type
listener StreamingQueryListener

Promise<void>

On a non-recoverable subscription drop the bus clears every listener; the caller must addListener again to restart.


awaitAnyTermination(timeoutMs?): Promise<boolean | undefined>;

Defined in: streaming/streaming-query-manager.ts:88

Block until any streaming query on this session terminates.

  • With timeoutMs: returns true if a query terminated within the timeout, false otherwise.
  • Without a timeout: blocks until something terminates, returns undefined.
Parameter Type
timeoutMs? number

Promise<boolean | undefined>

The timeout is in milliseconds, matching the Scala client and the Spark Connect timeout_ms wire field. PySpark’s awaitAnyTermination(timeout) takes seconds; pass 10_000 for the PySpark 10 equivalent.

SparkConnectError if a query terminated with an exception.


get(id): Promise<
| StreamingQuery
| null>;

Defined in: streaming/streaming-query-manager.ts:57

Look up a running query by id (the persistent identifier, not runId). Returns null when the server reports no matching query.

Parameter Type
id string

Promise< | StreamingQuery | null>


removeListener(listener): Promise<void>;

Defined in: streaming/streaming-query-manager.ts:132

Remove a previously-added listener. No-op if it isn’t registered. When the last listener is removed, tears down the subscription.

Parameter Type
listener StreamingQueryListener

Promise<void>


resetTerminated(): Promise<void>;

Defined in: streaming/streaming-query-manager.ts:106

Clear the “any query terminated” flag so the next call blocks again.

Promise<void>