Developing Apama Applications > Developing Apama Applications in EPL > Working with Streams and Stream Queries > Stream network lifetime > Disconnection vs termination
Disconnection vs termination
In the example above, quitting r6 disconnects Query D from stream 4. Because stream 4 has other stream queries using it this disconnection does not terminate stream 4 immediately. Streams terminate when all the queries using them have disconnected.
If you were instead to call quit() on r4, this would terminate everything on the right side of the diagram, no matter how many queries are using stream 4. However, the stream would just be disconnected from Query C. Whether this terminates Query C depends on the state of the join in Query C. If it is joining a size-based window from stream 4 the items in the window would remain to be joined against new items in stream 3. If it was a time-based window then Query C would remain until everything in the window had been discarded. At that point, since nothing can ever be added to that side of a join, Query C terminates, causing the rest of the network to also be terminated.
Copyright © 2013 Software AG, Darmstadt, Germany and/or Software AG USA Inc., Reston, VA, USA, and/or Terracotta Inc., San Francisco, CA, USA, and/or Software AG (Canada) Inc., Cambridge, Ontario, Canada, and/or, Software AG (UK) Ltd., Derby, United Kingdom, and/or Software A.G. (Israel) Ltd., Or-Yehuda, Israel and/or their licensors.