I have a Tcp-Server-Binding, realized as a class. Each instantiation 
(binding to an IP:port) produces a stream of "IncomingConnection"s. I also 
have a Tcp-Client-Object which produces a stream of "OutgoingConnection"s 
as a result to given new addresses (targets). For either, the BidiFlow from 
Framing.simpleFramingProtocol gets joined to the flow so I have messages to 
work with.


Each of those RunnableFlows is a "MyAppConnection", so that I am able to 
just send/receive Frames regardless of whether it is out- or ingoing.


I am able to send and receive over this construct. But now I would like to 
dynamically choose my destination (from within each node), and if there's 
no connection open already, have it open a new one. How would I realize 
this with backpressure remaining intact?


My idea was to create a mutable Map, where new connections get added and 
dead connections get removed. But isn't there a less messy pattern for 
that? Also I'm not sure how to preserve streams-backpressure with this 
approach.


FlexiRoute is out of the question, since once the Flow is made runnable, 
its immutable. Hence I need to know beforehand how many peers I'm talking 
to. Which might change at any given moment.


Here a little drawing of the runnable flow:

      ----------------  -----------  -------

  (~>)| |            |~>|         |~>|     |~> (out)

      | | Connection |  | Framing |  | MSG |

  (<~)| |            |<~|         |<~|     |<~ (in)

      ----------------  -----------  -------

                  MyAppConnection


Here the MSG stage provides both Source and Sink for the Flow while 
Connection (regardless of IncomingConnection or OutgoingConnection) is just 
crosswired to Framing.simpleFramingProtocol (BidiFlow) to provide the 
programmatical endpoint for my Flow.


-- 
>>>>>>>>>>      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