Hello, I was wondering what is the best way to clean up resources after an HttpResponse was sent over the network.
I need to use a legacy file-backed implementation of a buffer to get the data for HTTP responses. The API gives an InputStream to the data and eventually I need to call the cleanup methods (so the underlying file is deleted etc.). I can construct a source from the InputStream with StreamConverters.fromInputStream, so far so good. The source then is passed to the response entity: HttpEntity.Default(contentType, contentLength, respSource). The tricky bit is when to invoke the cleanup. It cannot be done as part of the flow which constructs the HttpResponse, because at this point the response entity hasn't read the data. The source passed to the entity is not yet materialised as I understand, so I don't have the Future[IOResult] instance, which I could wait for to execute the cleanup. I found something here, but is doesn't seem to give my the answer: https://github.com/akka/akka/issues/18571 Thank you David -- >>>>>>>>>> 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.
