Recently I started using scalaz streams in Scala/Akka.
I'm fetching records from a nosql database. I want to map records to message items (via translateItem: Item
) and create Packages (1 Package = 100 Items) of them. E.g. there are 500 records.
val readChunks = records.chunk(100)
val createPackages = readChunks.map(chunk => translateItem(chunk))
.map(i => toPackage(i))
val result = createPackages.runLog.run.toList
I've tried to fetch the result (the List[Package]
) via runLog
.
The output of the log looks good. But I don't need the logging overhead.
But how to write the result to a list e.g.?
Or I might return a Future[List[Package]]
and pass it to an Akka actor to fetch (Await.result
) it. I might convert the scalaz Task
to a Future
.
Thanks in advance.