Skip to content

Instantly share code, notes, and snippets.

Created December 22, 2012 08:18
Show Gist options
  • Select an option

  • Save anonymous/4358042 to your computer and use it in GitHub Desktop.

Select an option

Save anonymous/4358042 to your computer and use it in GitHub Desktop.
import play.api.libs.iteratee._
object EnumeratorHang {
def main(args: Array[String]) {
implicit val ec = scala.concurrent.ExecutionContext.Implicits.global
val enumerator = Concurrent.unicast[String] { channel =>
channel.push("foo")
channel.push("bar")
channel.end()
}
val future = enumerator.run(Iteratee.fold[String, String]("")(
(acc, s) => {
println(s)
acc + " " + s
}))
future onSuccess {
case result =>
println("Result: " + result)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment