Hi,

if you complete a request with a `Source` you can attach cleanup actions
using watchTermination.

On Thu, Jan 11, 2018 at 11:55 PM Daniel Armak <[email protected]> wrote:

> Is there a way to be notified when a response has been sent to the client?
>
> I’d like to cleanup some resources used to produce the response after I
> know it has been sent and that the non-strict HttpEntity I created will not
> be accessed again. After the cleanup runs, trying to materialize the entity
> data stream again would fail.
> The closest approximation I’ve found so far is to use mapRouteResult to
> call response.entity.transformDataBytes and use Flow.concat to run the
> code when the stream has been consumed (or fails). This seems imperfect,
> because it’s possible that the entity will be consumed more than once (in
> other word, the entity stream might be materialized more than once), e.g.
> by a badly coded outer directive. I’m not really worried that this will
> happen (without my tests catching it), but if there’s a better way I’d like
> to know about it.
>
> Thanks,
> ​
> --
> Daniel Armak
>
>
> --
> >>>>>>>>>> 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.
>

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