I'm trying to capture a file read in a reusable Flow as follows. But I'm
scratching my head about how to capture the materialized value. As it
stands the signature of result is Flow[Path, String, Unit] rather than
Flow[Path, String, Future[Long]]. I've tried various combinations of viaMat
and mapMaterializedValue but haven't been able to get the signatures right.
What am I missing? Thanks in advance.
def pathToIntervalLines: Flow[Path,String, Future[Long]] = {
val result = Flow[Path].flatMapConcat { path =>
val file = path.toFile
val fileSource: Source[ByteString, Future[Long]] = FileIO.fromFile(
file)
val asLines : Source[ByteString, Future[Long]] = fileSource.via(
Framing.delimiter(ByteString(System.lineSeparator), maximumFrameLength = 512,
allowTruncation = true))
val asStrings : Source[String, Future[Long]] = asLines.map { bs
=> bs.utf8String
}
asStrings
}
result
}
--
>>>>>>>>>> Read the docs: http://akka.io/docs/
>>>>>>>>>> Check the FAQ:
>>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user
---
You received this message because you are subscribed to the Google Groups "Akka
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.