Hi Ivan, I guess it depends on how you want to use this connection exactly. As TCP is a stream-based protocol there's usually some state associated with a connection that needs to be regarded when a new connection is opened. Therefore, there cannot be a general solution to the problem that would work for all kind of bidirectional stream-based protocols.
E.g. for HTTP you need to keep track of which requests are still outstanding and resubmit them on the next connection. For an FTP download you would have to remember how much you had already downloaded and resume there. Each protocol will need its own rules you would need to implement. Depending on the requirements the stream setup needs to be customized. E.g. here's part of the setup we use for the HTTP client connection pool: https://github.com/akka/akka-http/blob/a399d99eddd7ba83121ac75ff479fe31d8e2aa7d/akka-http-core/src/main/scala/akka/http/impl/engine/client/PoolFlow.scala#L27 Each slot is implemented as a `GraphStage` that keeps track of the state of one connection. If that connection fails or is closed for any reason, the slot is responsible for creating a new connection. Depending on your use-case there might be much simpler approaches but as so often, it depends ;) Johannes On Tuesday, May 23, 2017 at 2:33:11 PM UTC+2, ivan morozov wrote: > > Hi, > > I'm using tcp for outgoing connection in akka streams. > > Tcp().outgoingConnection(...) > > if the target connection drops you can see something like this in debug > logs > > [DEBUG] [05/23/2017 14:08:41.968] [default-akka.actor.default-dispatcher-5 > ] [akka://default/system/IO-TCP/selectors/$a/0] Closing connection due to > IO error java.io.IOException: Broken pipe > > > How to configure a retry with a delay? > > To reproduce, run something like > > Source.repeat(1).via(Tcp.outgoingConnection("localhost",port)).to(Sink. > ignore).run() > > nc -lkv port > > and then kill netcat with CTRL + C and retry. > > Thanks > -- >>>>>>>>>> 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 https://groups.google.com/group/akka-user. For more options, visit https://groups.google.com/d/optout.
