Hi,

I've been looking for a way to create a client that upon disconnection will 
try to reconnect.
I've done this in the past with RxJava observables, but I'm not sure how to 
do this using Akka Streams.

I saw some code examples where PushStage is being used to implement this, 
but the code samples are old (the API has changed) and I'm not sure exactly 
how to migrate them correctly.
In the code examples, it seems like past versions of the API allowed 
outgoing TCP connections to be handled using a function (by calling 
handleWith), which means a lazy approach could be used.
I *think* this is no longer possible.

So I figured I can get the same effect with an approach similar to what 
I've used in the past with Rx observables - create a Source of TCP outgoing 
connection flows.
Essentially what I need is similar to a theoretic Source.repeat[T](gen: 
()=>T).
There's no such method on Source, so I implemented this using 
ActorPublisher.
I plan to also have some delay between re-connection attempts with an 
exponential backoff and also support multiple target hosts, but for now I 
only want to immediately reconnect to the same address.

If I didn't care about how many connections my client actually opens at the 
same time, I could say this approach works.
In actuality I do, of course, care and I only want a single connection to 
be open at any given time.
Unfortunately, the Request objects my ActorPublisher receives contain 
numbers larger than 1.

Is there a way to force the downstream flow to only ask for a single item 
at a time?
Alternatively, is there actually a better way to achieve my original goal 
(a TCP client that reconnects)?

-- 
>>>>>>>>>>      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 http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to