Actually I was going to ask a follow-up question on developing this code -- and now that the Akka tech-lead has got involved, maybe there's no better time ;-) -- I'd like to try and adapt it to receive files via chunked POST.
I'm wondering if it is possible to dynamically adjust the upload rate of a single request using a flow that employs an ActorSubscriber[ByteString]. Before I start wandering in circles -- is this sort of thing even possible using akka-http? Thanks again for the foundation. On Monday, 16 February 2015 08:24:46 UTC, rkuhn wrote: > > Hi Rüdiger, > > thanks for sharing! Since you ask, there is one thing that might be > improved (though not problematic in your example): when constructing a > Source from an Iterator the Iterator should be created by the factory that > is provided, so that the Source may be reused (remember our mantra: > everything in the DSL shall serve as reusable blueprints wherever > possible). This would mean: > > val chunks = Source(() => new ByteBufferIterator(mappedByteBuffer, > 4096)).map(ChunkStreamPart) > > Regards, > > Roland > > 13 feb 2015 kl. 21:34 skrev Rüdiger Klaehn <[email protected] <javascript:> > >: > > Here is a gist of a small file server that uses chunked encoding. You > should be able to see the backpressure work with this. > > > https://gist.github.com/rklaehn/3f26c3f80e5870831f52#file-file-server-example > > If you run it, it opens a server on localhost, port 8080, that serves > all files on your system. So just put some large text file somewhere > in your home directory, start the server, and get it with curl like > this: > > curl --limit-rate 1k > http://127.0.0.1:8080/Users/rklaehn/tmp/somelargetext.txt > > You can see on the server side that new chunks are produced at the > rate that curl consumes them => backpressure. > > Warning: I wrote this before I was really familiar with akka-streams. > So the code might be not exactly idiomatic. > > Hth, > > Rüdiger > > On Fri, Feb 13, 2015 at 10:22 AM, dan costelloe <[email protected] > <javascript:>> wrote: > > > Hi Rüdiger, > > On Tuesday, 28 October 2014 09:22:07 UTC, rklaehn wrote: > > > Hi all, > > I am doing some testing with akka-http and chunked encoding. I want to > investigate the backpressure behavior, so I am using curl with > --limit-rate 1k on the client side. I should I see backpressure when > using akka-http to send a HttpEntity.Chunked, right? > > > > For the purposes of educating a newbie, would you be so kind as to share > your code and curl settings for this test? > > Much obliged! > dan > > -- > > 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] <javascript:>. > To post to this group, send email to [email protected] > <javascript:>. > Visit this group at http://groups.google.com/group/akka-user. > For more options, visit https://groups.google.com/d/optout. > > > -- > > 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] <javascript:>. > To post to this group, send email to [email protected] > <javascript:>. > Visit this group at http://groups.google.com/group/akka-user. > For more options, visit https://groups.google.com/d/optout. > > > > > Dr. Roland Kuhn > Akka Tech Lead > Typesafe – Reactive apps on the JVM. > twitter: @rolandkuhn > > > -- >>>>>>>>>> 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.
