0

Lookint at the definition of the Flow class on https://doc.akka.io/api/akka/current/akka/stream/scaladsl/Flow.html, it has the following signature:

 final class Flow[-In, +Out, +Mat] 

The question is, why is the type of the third parameter is +Mat? I thought, +Mat makes only sense on Sink, because Sink consumes the stream.
Even the Source has the +Mat:

final class Source[+Out, +Mat]  
softshipper
  • 32,463
  • 51
  • 192
  • 400

1 Answers1

3

Each stage materializes in some value, this is what gives you the ability to obtain a mechanism to push elements into the stream via a SourceQueueWithComplete when you use a Source.queue.

Even a Flow could materialize in some value but this isn't common, in this cases you'll see that the materialized value is NotUsed.

gabrielgiussi
  • 9,245
  • 7
  • 41
  • 71