Hi Yaakov, See: http://doc.akka.io/docs/akka-stream-and-http-experimental/2.0.1/scala/http/routing-dsl/index.html#File_uploads
In short: you need to send the response *after* the upload has been completed. On Sun, Jan 3, 2016 at 4:13 PM, Yaakov Berkovitch < [email protected]> wrote: > Hi, > > I'm trying to create a simple http-server that consumes slowly incoming > http request . This is a kind of self-learning session and to demonstrate > it internally in my company as Roland did it during some conference. > > My problem is that my flow is not slowing down and curl terminates > immediately. > > Below is the relevant code: > val slowFlow = Flow[ByteString].mapAsync(1){x => after(10.second, system > .scheduler)(Future.successful(x))} > val routes = > > path("upload") { > > extractRequest { req => > > println(req) > req.entity.dataBytes.via(slowFlow).to(Sink.ignore).run() > complete(StatusCodes.OK) > } > } > > > > Thanks, > Yaakov > > -- > >>>>>>>>>> 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. > -- Cheers, √ -- >>>>>>>>>> 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.
