Hi Chongkai, The ActorPublisher can call onComplete or onError to finish the write side of the TCP connection. Depending whether you used "halfClose = true" or "halfClose = false" on the TCP connection (default is true for outgoing connections) the connection will be kept or immediately disconnected. The read side can be closed by calling "cancel()" in the ActorSubscriber. As there is no such thing in TCP as closing the read side, this will just ignore incoming bytes.
-Endre On Thu, Sep 10, 2015 at 6:58 AM, Chongkai Jiang <[email protected]> wrote: > Sorry I know this is rather silly question, but I have to jump to Akka > streams before I completely understand everything, because I need its TLS > support to do async IO, to implement an async Thrift client. > > val sslContext = ... > val tls = SslTls(sslContext, NegotiateNewSession(None, None, None, None), > Client) > val transport = Tcp()(system).outgoingConnection(ip, port) > val flow = tls.join(transport) > Source(ActorPublisher[SslTlsOutbound](writer)).via(flow).runWith(Sink( > ActorSubscriber[SslTlsInbound](reader))) > > reader and writer are two actors: reader gets ByteString and translates to > Thrift responses and deliver them to application; write translates Thrift > requests to ByteString and send out. > > It seems to work well. But how to make it stop, being sure the TCP connection > has been closed? > > > Thanks for your help! > > -- > >>>>>>>>>> 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. > -- Akka Team Typesafe - Reactive apps on the JVM Blog: letitcrash.com Twitter: @akkateam -- >>>>>>>>>> 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.
