Hi,
My usecase: I get a List of elements that contain ids to download stuff. I
want to download everything and afterwards
group it together to the corresponding elements. So I tried doing this with
a simple example:
implicit val system = ActorSystem("test-streams")
implicit val materializer = ActorMaterializer()
implicit val context = system.dispatcher
val source: Source[List[Int], Unit] = Source(List(1, 2, 3, 4, 5).map(n =>
List.fill(n)(n)))
source
// produces a flow of ints
.mapConcat(identity)
// recreate initial grouping n => List.of(n)
.groupBy(identity)
// fold the grouped values into a list
.map {
case (key, list) => list.fold(List.empty[Int])(_ :+ _)
}
// flatten the multiple sources into the stream
.flatten(FlattenStrategy.concat)
// print them out
.runForeach(println)
// shutdown everything
.onComplete { result =>
// Failure(akka.stream.impl.StreamSubscriptionTimeoutSupport$$anon$2:
Publisher
(akka.stream.impl.MultiStreamOutputProcessor$SubstreamOutput@45963726) you
are trying to subscribe to has been shut-down because exceeding it's
subscription-timeout.)
println(result)
system.shutdown()
system.awaitTermination()
}
which is not working as expected. I'm not sure where I'm messing things up.
The order of operations *concat -> groupBy ( and fold) -> flatten* don't
seem to work.
thanks,
Muki
--
>>>>>>>>>> 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 http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.