Hello, I was playing around with Stream API 2.0 where I got a strange error-message:
"Cannot materialize an incoming connection Flow twice.". I could track down the issue to a code-line. So this what I am doing Server code: val connections = Tcp().bind(localHost.getHostName, port, backlog, socketOptions, idleTimeout = 10.seconds) connections.runForeach(handleConnnection(_)) where the handleConnection function spawns an Actor which setups a flow like this: conn.handleWith(getLogicalFlow()) Now I set some kind of timer that should close the connection (To prevent long open TCP Connections that I for example got from a Loadbalancer I put in front of my Server application). I did this with Akka Streaming 1.X like this: def closeConnection(connection: Tcp.IncomingConnection): Unit = { implicit val materializer = ActorMaterializer() // Handle connection with the closing Flow connection.flow.runWith(Source.empty, Sink.cancelled) } I also tried: connection.handleWith(Flow.fromSinkAndSource(Sink.cancelled, Source.empty)) But the problem seems like that I cannot change the flow as soon as it materialized. Any good thoughts on how I could fix this? Regards, Thomas -- >>>>>>>>>> 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 https://groups.google.com/group/akka-user. For more options, visit https://groups.google.com/d/optout.