Maybe I don't understand the problem at hand yet -- you can almost certainly do this without language help. Can you help out with a concrete example or problematic code?
On Friday, May 5, 2017 at 2:18:17 PM UTC-4, Brian Craft wrote: > > This looks like a partial solution: > > https://github.com/pjstadig/scopes > > perhaps inspired by this discussion: > > https://dev.clojure.org/display/design/Resource+Scopes > > > > On Friday, May 5, 2017 at 5:10:27 AM UTC-7, Herwig Hochleitner wrote: >> >> 2017-05-04 19:35 GMT+02:00 Brian Craft <[email protected]>: >>> >>> If there's only one with-open it can be reasonably simple to pass the >>> consumer into that context (though from ring it's pretty convoluted, due to >>> needing to pass control to ring first). >>> >> >> Creating streamed ring responses can be kind of tricky. In my experience, >> there are two patterns, that work well: >> >> 1) Feeding a PipedInputStream from a new thread: >> >> (let [os (PipedOutputStream.) >> is (PipedInputStream. os)] >> (future (with-open [rs ...] >> (write-to! os rs))) >> {:body is}) >> >> 2) Use a ring adapter that allows some form of asynchronous response. >> E.g. with the new ring 1.6 model >> >> {:body (reify ring.core.protocols/StreamableResponseBody >> (write-body-to-stream [_ _ output-stream] >> (with-open [rs ... >> os output-stream] >> (write-to! os rs))))} >> >> > -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to [email protected] Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
