Hey hAkkers!

I need your advise in akka streams materialization question.

I have custom protocol source `MySource` of type`Source[String, ActorRef]` 
which accepts messages to control protocol via ActorRef after 
materialization. Example of message is something like connect to server or 
change parameters of existing connection and so on.

Creation of flow with this API is easy:

```
val actor = MySource().to(Sink.ignore).run
actor ! SomeCommand()
```

Next, I have `Source[Command, Unit]` and I want to be able to connect it to 
`MySource`. So I need to lift `MySource` from source to `Flow`:

```
val source: Source[String, ActorRef] = ???

//some magic with custom stage or partial flow here and
val controlledSource: Flow[Command, String, ActorRef] = ???
```

I tried to do it with partial flow:

```
  val flow = FlowGraph.partial() { implicit b =>
    import FlowGraph.Implicits._
    val mySource = MySource
    val commandsInput = Sink.foreach[Command](???) //I need ActorRef here :(
    FlowShape(b.add(commandsInput).inlet, b.add(mySource).outlet)
  }
```

but to connect commands with source I need result of materialization.

Any ideas how to keep `Source[String, ActorRef]` and have `Flow[Command, 
String, ActorRef]`?

-- 
>>>>>>>>>>      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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to