Question

When I try the following 'Hello World' example from here, the application will never stop. Is it the Iteratee, waiting for ever more input? I tried to so something like

val enumerator = Enumerator(1, 234, 455, 987).andThen(Enumerator.enumInput(Input.EOF))

but it does not help.

What do I have to do to make the application stop after the Iteratee is done with all elements from Enumerator?

import scala.concurrent.Future
import play.api.libs.iteratee._
import scala.concurrent.ExecutionContext.Implicits.global

object Experiment 
{       
  def main(args: Array[String]) 
  {
     val enumerator = Enumerator(1, 234, 455, 987)
     enumerator(Iteratee.foreach( println _ ))

     // same result with apply   
     //enumerator.apply(Iteratee.foreach( println _ ))

     println("Main is done pretty soon but the application will never stop.")
   }
}

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top