Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- object FunctionToFlow {
- import akka.stream._
- import akka.stream.scaladsl.{ FlowGraph, Flow }
- def apply[A, B](f: A => B): Graph[FlowShape[A, B], Unit] =
- FlowGraph.partial() { implicit b =>
- val transformation = b.add(Flow[A].map(f))
- new FlowShape[A, B](
- transformation.inlet,
- transformation.outlet
- )
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement