You should take a look at Chunked MessageEntity [1]. You can trivially map 
your stream of ByteStrings into a stream of ChunkStreamParts and create 
HTTP request payload this way.
Things to note: the server must support Tranfer-encoding: chunked. If the 
application code expects newlines as separators, you must add them 
explicitly while creating the chunks. However if the chunking is not 
handled transparently on the server ie. application code receives a stream 
of chunks you might as well exploit that for delimiting messages. Remember 
to terminate the stream with a proper LastChunk, otherwise the request will 
stall and eventually time out.

Cheers,
Rafał

[1] 
http://doc.akka.io/api/akka/2.4/?_ga=1.23365754.1388425308.1467760779#akka.http.scaladsl.model.HttpEntity$$Chunked

W dniu niedziela, 23 października 2016 08:31:54 UTC+2 użytkownik Wolfie 
napisał:
>
> I have an akka-http (Java DSL) problem that I'm unable to figure out how 
> to do. I could use some help.
>
> I have a long running Source that emits newline delimited ByteString 
> messages of an indeterminate number that I want to POST to a webserver. 
> Verifying the response was successful at the end at the client.
>

-- 
>>>>>>>>>>      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.

Reply via email to