Advertisement
Guest User

Untitled

a guest
Oct 13th, 2015
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1. object FunctionToFlow {
  2.  
  3. import akka.stream._
  4. import akka.stream.scaladsl.{ FlowGraph, Flow }
  5.  
  6. def apply[A, B](f: A => B): Graph[FlowShape[A, B], Unit] =
  7. FlowGraph.partial() { implicit b =>
  8. val transformation = b.add(Flow[A].map(f))
  9. new FlowShape[A, B](
  10. transformation.inlet,
  11. transformation.outlet
  12. )
  13. }
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement