I am trying to create a Source[Out,Mat] from a Future[Source[Out,Mat]] and was using the built-in source.fromFuture for that in combination with flatMapConcat. However when using fromFuture the source has a materialized value of NotUsed. When flatMapConcatenating the actual source, the materialized value keeps being notUsed.
Is it possible to take the materialized value of a source which is used inside the flatMapConcat?
The code looks as follows:
def sourceFromFutureSource[Out,Mat](futureSource: Future[Source[Out,Mat]]): Source[Out, Mat] = {
Source.fromFuture(futureSource)
.flatMapConcat(identity)
}
Since Akka 2.5.1 it is possible to use Source.fromFutureSource. Now you can do Source.fromFutureSource(futureSource)
.