Dear hakkers, I have been trying to add back pressure to an akka-http application using a transformation Stage and I have found something... unexpected. I have created a SafetyStage that buffers up to a maximum number of elements:
https://github.com/lvicentesanchez/random/blob/master/src/main/scala/io/github/lvicentesanchez/streams/stage/SafetyStage.scala I have also simulated a random failure with a simple random number generator. Instead of handling akka-http connections using the method handleWith of the ServerBinding object, I'm creating the following FlowGraph: https://github.com/lvicentesanchez/random/blob/master/src/main/scala/io/github/lvicentesanchez/Boot.scala#L56 The connection Source is transformed using the SafetyStage. If the maximum capacity, or a random error happens, a Left object is created; if not, a Right object is created. A FlexiRoute sends the Left requests to a sink that handles every failed/discarded connnection (it completes them with 503 error); Right requests go to a sink that handles them using an akka-http router. In my tests, once one of the Sink handles the first IncomingConnnection, all future connections are handled using the "handler" of that Sink. I.e. if the random number generator decided that the first connection suffered an error, all future connections would also be completed with a 503 error. I guess what I'm trying to do is fundamentally wrong, but I still don't understand why the transformation stage is completely ignored once the first connection is handled. Regards, Luis -- >>>>>>>>>> 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.
