Problem solved, working code is: GraphDSL.create(connectionActorSource) { implicit builder => connectionActorSource => import GraphDSL.Implicits._ val connectionActor = builder.materializedValue.map { playerConnection => connectionManager ! ConnectionManagerActor.Register(nickname, playerConnection) } val decodeFlow = builder.add(decode) val encodeFlow = builder.add(encode) val userActorSink = Sink.actorRef[WsMessage](createUserActor(nickname), Logout(nickname)) connectionActor ~> Sink.ignore decodeFlow ~> userActorSink connectionActorSource ~> encodeFlow FlowShape(decodeFlow.in, encodeFlow.out) }
среда, 14 декабря 2016 г., 23:24:59 UTC+3 пользователь Владимир Морозов написал: > > Hi all, > > I try to use materialized value, in my case builder.materializedValue > contains ActorRef that hold websocket connection. I don’t want to send > it to my userActor. How I can solve that problem? > > Flow.fromGraph(GraphDSL.create(connectionActorSource) { implicit builder => > connectionActorSource => > import GraphDSL.Implicits._ > > builder.materializedValue.map { case playerConnection => > connectionManager ! ConnectionManagerActor.Register(nickname, > playerConnection) > } > > val decodeFlow = builder.add(decode) > val encodeFlow = builder.add(encode) > val userActorSink = > Sink.actorRef[WsMessage](createUserActor(nickname), Logout(nickname)) > > decodeFlow ~> userActorSink > connectionActor ~> encodeFlow > > FlowShape(decodeFlow.in, encodeFlow.out) > }) > > Error when I run it: > > The inlets [Collect.in] and outlets [Map.out] must correspond to the > inlets [Collect.in] and outlets [Collect.out, Map.out] > > May be exists some other way to get value from connectionActorSource > -- >>>>>>>>>> Read the docs: http://akka.io/docs/ >>>>>>>>>> Check the FAQ: >>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html >>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user --- You received this message because you are subscribed to the Google Groups "Akka User List" group. To unsubscribe from this group and stop receiving emails from it, send an email to akka-user+unsubscr...@googlegroups.com. To post to this group, send email to akka-user@googlegroups.com. Visit this group at https://groups.google.com/group/akka-user. For more options, visit https://groups.google.com/d/optout.