Hello hAkkers, It's me again. Is it possible to know when outgoing
connection will be closed and then complete closeConn promise or throw
failure in flow context? Without closeConn promise I can't work with idle
stream.
This is an example for issue:
```
val serverAddress = new InetSocketAddress("coreos", 2375)
val closeConn = Promise[ByteString]()
val source = Source(closeConn.future).drop(1) // as an example. In the
real application, source is a WS endless stream of commands from user.
Tcp()
.outgoingConnection(serverAddress)
.runWith(source, Sink.foreach(println))
```
When outgoing connection has been closed then I saw a debug message "Read
returned end-of-stream, our side not yet closed". How to avoid this kind of
leak?
I did try to add StatefulStage to tcp stream and watch on onUpstreamFinish:
```
class CloseStage extends StatefulStage[ByteString, ByteString] {
def initial: State = new State {
def onPush(elem: ByteString, ctx: Context[ByteString]):
SyncDirective =
ctx.push(elem)
def onUpstreamFinish(ctx: Context[ByteString]):
TerminationDirective = {
println("onUpstreamFinish")
???
}
}
}
Tcp()
.outgoingConnection(serverAddress)
.transform(() => new CloseStage())
.runWith(source, Sink.foreach(println))
```
But nothing happened.
Am I right?
Thank you.
--
>>>>>>>>>> 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.