I'm really having trouble understanding the fundamental purposes for Play's Iteratees and Enumerators.
I've read
I read this answer to find that instead of relying on a pulling model, like InputStream, it uses a pushing model.
Iteratees are an interesting beast -- on one hand, it "pushes" data to the handler, instead of relying to the handler to pull data, and, therefore, has better performance. On the other hand, it allows the handler to control when the flow should be stopped.
But then Play's documentation on Iteratees says
Or more generally enumerating a
java.io.InputStreamusingEnumerator.fromStream. It is important to note that input won’t be read until the iteratee this Enumerator is applied on is ready to take more input.
Wait....so what is going on?
Does the data get pushed by the Enumerator or pulled by the Iteratee? (i.e. who decides when it is time to calculate more data)