I am trying to understand what does toMat in akka streaming. For example:
val sink1:Sink[Int, Future[Int]]=Sink.fold[Int,Int](0)(_ + _)
val flow=Flow[Int].fold[Int](0){(x,y)=> x+y}
val runnable = Source (1 to 10).viaMat(flow)(Keep.right).toMat(sink1)(Keep.both)
- what is use of viaMat vs via?
- what is toMat is doing between viaMat to toMat?
- what is use of keep.both, does it mean I can have value materialized from previous and the current one if yes then how I can get those values back.
Thanks Arun