Well in our case we did not add all this in the beginning, than had to find 
and fix them case by case because of real issues in production :/

2017. június 20., kedd 9:23:28 UTC+2 időpontban Erwan Loisant a következőt 
írta:
>
> Thank you, I'll try that!
>
> But that's a lot of boilerplate, do everyone actually do all of that each 
> time they need to Unmarshal a result?
>
> On Monday, June 19, 2017 at 8:06:37 PM UTC+2, Daniel Vigovszky wrote:
>>
>> Hi, make sure you catch all exceptions, for example if the unmarshaller 
>> dies you still have to consume the entity. For example by putting a 
>> recoverWith case on the unmarshaller's future something like this:
>>
>> Unmarshal(response.entity)
>>   .to[T]
>>   .recoverWith {
>>     case reason: Throwable =>    
>>         val result = Future.failed(reason)
>>         if (response.status.allowsEntity) {
>>             response.discardEntityBytes()
>>             .future()
>>             .flatMap(_ => result)
>>             .recoverWith { case _: IllegalStateException => result } // 
>> If the entity was already consumed by a failing unmarshaller
>>         } else {
>>             result
>>         }
>>   }
>>
>> vigoo
>>
>> 2017. június 19., hétfő 18:05:46 UTC+2 időpontban Erwan Loisant a 
>> következőt írta:
>>>
>>> Hi,
>>>
>>> I'm migrating a big project from dispatch to Akka http for client calls. 
>>> I'm having an issues in our tests, we're sending a lot of calls and at some 
>>> point I'm not getting any response, i.e. with the request-level API the 
>>> Future never completes.
>>>
>>> From what I have read, that can happen when we don't consume the entity 
>>> bytes so I'm making sure we always either Unmarshal the entity, or call 
>>> response.discardEntityBytes.
>>>
>>> What could cause that? Do you confirm that Unmarshal will consume the 
>>> entity bytes and free a connection? Is there something else I need to be 
>>> careful in my calls? Or is there a way I can monitor the request pools 
>>> created by Akka http to debug my code?
>>>
>>>
>>> Thank you!
>>>
>>

-- 
>>>>>>>>>>      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 akka-user+unsubscr...@googlegroups.com.
To post to this group, send email to akka-user@googlegroups.com.
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