Thanks @malcolmsparks I’m really interested in how it might work as the main bus of an application. I’ll give it a go myself and see what comes out.
(this worked btw: https://clojurians.slack.com/archives/C0702A7SB/p1540198897000100)
Made a branch of yada with speculative tests. Found no errors. https://github.com/borkdude/yada/tree/speculative-tests
if I want to use something that needs a java.io.Writer to create the body for a yada response, what is a good way to do this (i.e. what type of 'thing' do I write to? does yada e.g. create content from an OutputStream. what should I do to make sure the writer doesn't get closed before the request is returned?) Or is it just easier to use (with-out-str (write-the-thing *out*))
?
@stijn you could give it a java.io.StringWriter
too - presumably you are going to call this thing on a manifold.deferred/future
?
that might indeed be a problem on a different thread
@mccraigmccraig but what about the with-open that's usually used for this kind of writing. does that work with futures?
it doesn't matter for a StringWriter
- it doesn't actually hold any i/o resources open - if it were something like a FileWriter
with a file-handle though you could use with-open
inside the body of the future
looking at with-out-str
it just uses a StringWriter
so probly use that https://github.com/clojure/clojure/blob/b98ba848d04867c5542d50e46429d9c1f2472719/src/clj/clojure/core.clj#L4682