Quantcast
Channel: Akka Libraries - Discussion Forum for Akka technologies
Viewing all articles
Browse latest Browse all 1362

groupBy within akka stream

$
0
0

@willgu wrote:

Hi everyone. I was testing my stream and found the following phenomenon.

  Source((0 until 100).zipWithIndex)
      .groupedWithin(10, 10 millisecond)
      .map { seq =>
        seq.groupBy(x => x._1 % 2)
          .mapValues { v =>
            println(s"doing stuff ${v.map(_._2)}") // <-- this won't print
            v.size
          }
      }
      .toMat(Sink.ignore)(Keep.both)
      .run()

However, if I change mapValues to map. It prints alright. Any idea why this might happen?

Posts: 3

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 1362

Trending Articles