Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.vertigo.mapping.persistence
- import akka.actor.ActorSystem
- import akka.stream._
- import akka.stream.scaladsl._
- object X {
- implicit val system: ActorSystem = ActorSystem("MyTest")
- implicit val matt: ActorMaterializer = ActorMaterializer()
- def mainFlow(): Unit = {
- val grp = RunnableGraph.fromGraph(GraphDSL.create() {
- implicit builder =>
- import GraphDSL.Implicits._
- val src = builder.add(Source(1 to 100)).out
- val flw1 = builder.add(Flow[Int].map(x => x * 10).take(20))
- val flw2 = builder.add(Flow[Int].filter(x => x > 50))
- val snk2 = builder.add(Sink.foreach(println)).in
- src ~> flw1 ~> flw2 ~> snk2
- ClosedShape
- }).run
- }
- def main(str: Array[String]): Unit = {
- mainFlow()
- }
- }
Add Comment
Please, Sign In to add comment