so if the user sends 4gb you want to load it all into memory and crash the
jvm? :-)

What's the use-case where you can't stream it?

-- 
Cheers,
√
On 30 Jul 2015 10:31, <[email protected]> wrote:

> the usecase is getting a "complete"  ByteString from a from HttpResponse.
>
> I joinded a BidiFlow ( above code shows this BidiFlows bottom channel)
> with Http.get().cachedHostConnectionPool() Flow
>
> Am Donnerstag, 30. Juli 2015 08:54:22 UTC+2 schrieb √:
>>
>> What's the use-case?
>>
>> --
>> Cheers,
>> √
>> On 30 Jul 2015 08:18, <[email protected]> wrote:
>>
>>> // this is part of a BidiFlow
>>>
>>> FlowShape<Tuple2<Try<HttpResponse>, RequestResult>,
>>>       Tuple2<ByteString, Object>>
>>>       bottom =
>>>       b.graph(Flow.<Tuple2<Try<HttpResponse>, Object>>empty().
>>>             mapAsync(4, pair ->
>>>                         getEntityBytes(pair._1().get(), pair._2(), 
>>> materializer)
>>>             ).map((pair) -> new Tuple2<>(pair._1(), pair._2())));
>>>
>>>
>>>
>>> static Future<Tuple2<ByteString, RequestResult>>
>>>    getEntityBytes( final HttpResponse response,
>>>                    final Object requestResult,
>>>                    final ActorMaterializer materializer) {
>>>
>>>    return response.entity().getDataBytes().runFold(
>>>          new Tuple2(ByteString.empty(),requestResult),
>>>          (aggr, next) -> new Tuple2(aggr._1().concat(next),aggr._2()), 
>>> materializer);
>>> }
>>>
>>>
>>>
>>>
>>>
>>> What looks a little funny to me is that I need to pass a materializer
>>> to the inner flow?
>>>
>>> I am a little unsure because the docs Modularity, Composition and
>>> Hierarchy state:
>>> "It is rarely useful to embed a closed graph shape in a larger graph"
>>>
>>>  --
>>> >>>>>>>>>> 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.
>>>
>>

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

Reply via email to