Rules for termination of stream networks
The complete set of rules for when a part of a stream network is terminated are:
Stream listeners:
quit() is called on a
listener variable pointing at that stream listener.
The stream the listener is connected to is terminated.
Streams:
quit() is called on a
stream variable pointing at that stream.
The stream query generating the stream is terminated.
All the stream queries using the stream are terminated.
Stream queries:
The stream the query generates is terminated.
All of the streams the query uses are terminated and either the query does not define a window or it defines a
within or
within...every window and there are no live items in the window.
A live item is an item whose expiration (the item falls out of the window) can cause query output. For example, if the only items in a timed window fail to satisfy a where clause in the window definition, then those items cannot change query output when they expire.
If none of the items in the window are live, the query terminates when all items have fallen out of the window. However, the query might terminate earlier if the correlator can determine that none of the items are live and that all streams that the query uses have terminated. Regardless of when such a query quits, there are no observable effects except in two situations:
The query is the only thing keeping the monitor active. That is, when the query terminates, then the monitor's
ondie() action is called.
Calculation of the size of the window has one or more side effects.
Stream source templates:
The stream the stream source template generates is terminated.