Fork me on GitHub

Anyone with experience with ? I have a "process" (single thread actually) that pulls data from SQS. In the event that SQS or network falls over transiently, I'd like to back off and retry a little bit later. A circuit breaker seems like a useful abstraction...

Christian Johansen10:11:34

When using reify with a Java interface, is there some way to store state on this, or do I need to keep state eg in a separate atom?


fwiw, the following pattern works:

(let [a (atom nil)]
  (reify ...))
i.e. the atom is not very disjointed from the reify. This is documented: ...and can refer to the surrounding local scope

Christian Johansen12:11:48

yeah, this is what I did. just felt a little awkward


at the same time, imagine rich had to choose (and impose!) a specific state model implicit in reify bodies... e.g. built-in atom? or built-in Java volatiles? tough choice

Christian Johansen13:11:30

yup, probably makes sense


Are there any tutorials/details on how to deploy a JAR/WAR to an Azure app service? (I can't use another cloud provider due to client limitations) Deploying WARs on Tomcat keeps stopping me as there's no services folder under META-INF. If that's manually added to the META-INF I get a lot of truncated class errors or ClassNotFoundExceptions, despite them appearing in the extracted WAR Deploying a JAR seems to just die and I can't figure out why yet The couple of things written on the subject are either "just host a VM" or are around using the Azure webapp maven plugin, which I don't understand how to interface with Lein/whatever other loader I need to use Any help is appreciated


Given a coordinate vector such as '[lambdaisland/deep-diff "0.0-29"] , is there a handy function that will print its description? Ideally fetching it from ~/.m2 , for speed


Would you expect this to work?

(->> values
     (map async-fn)
     (a/into {})

๐Ÿ‘ 4
facepalm 8

if I would publish a library with java code that uses clojure.lang.RT and that lib would for example depend on 1.9, will that library be usable in a project which depends on clojure 1.10?


In general there is no promise by the Clojure core team that such things will work. They do not consider clojure.lang.RT as part of the public API of Clojure's implementation.


In practice, it will often work between two consecutive Clojure versions, but you don't have cause for complaints or bug filing if it doesn't.

Alex Miller (Clojure team)15:11:16

Generally, yes. Calls to RT get embedded into aotโ€™ed code so as a general policy we only ever make additive changes to it (I canโ€™t remember an exception to that in the last 7 yrs at least)


@U04V15CAJ Why use clojure.lang.RT when you have which is a public, supported API?


@U04V70XH6 because I needed the unpublic API to replicate some behavior of Vars, but it turns out I can do it in Clojure itself ๐Ÿ™‚


so, this question is now obsolete, but still good to know

Christian Johansen21:11:24

I recently asked for consuming server-sent events from Clojure. There was little help to find, so now there is this:


this library calls join on a thread inside a go block, which is a very bad thing


you could fix it by calling thread instead of go at the end of connect, otherwise this code can deadlock all of core.async just by having enough requests in flight


in fact, you don't even need thread, you could just use future, as that body doesn't need any core.async features

Christian Johansen21:11:44

that's pretty damn fast code review ๐Ÿ™‚


I'm debating whether I'm too lazy to create an issue on htis lib haha

Christian Johansen21:11:00

It's OK, I'll just fix it immediately


it's easy because everybody predictably makes this mistake


ahh! I didn't realize it was your code until just now

Christian Johansen21:11:42

so basically replace go with future, and that's it?


right - the gotcha with future (and thread) are that they can leave failures in limbo, but the try catch you already have addresses this

Christian Johansen21:11:22

I have very limited experience with Java futures ๐Ÿ˜•

Christian Johansen21:11:50

I did test it. It's basically there to catch connection problems


the future macro takes arbitrary code in an implicit do, and ensures that it runs in a new thread with clojure bindings conveyed for dynamic vars


right - this code works great for < N connections, then with N connections in flight all of core.async stops


but future (and async/thread) uses a cached expandable pool, which adresses this issue

Christian Johansen21:11:59

thanks alot for the quick and detailed feedback!


and a minor style thing: instead of

(try (.join res) (close! port) (catch ... (close! port)))
you can have
(try (.join res) (catch ...) (finally (close! port)))


unless the catch has to act on errors in (close! port) - but in that case it shouldn't be trying to do it again, right?

Christian Johansen21:11:43

no, the close here is just a best effort really

Christian Johansen21:11:12

if you already closed it, you're doing some strange stuff, and if it's closed, it's closed

Christian Johansen21:11:28

alright, new version on Clojars and github, thanks again ๐Ÿ™‚

Christian Johansen21:11:38

it uses the stuff from Java 11


I want to add two methods to a deftype, e.g.:

(defprotocol IBox
  (setVal [_ _])
  (getVal [_]))
But I want to keep IBox private, is that possible?


yes, I'm already having that. I guess that's enough


I do not know if it works for anything other than def and defn, but did you try adding ^:private metadata to the name?


โ— Does someone happen to have a copy of Enter Integrant by @weavejester? It looks like the company hosting the video linked in the Integrant repo has gone under administration: - sad, and it looks like there's replacement talks out there that aren't this talk (including by @weavejester), but it would nice to preserve it, though I don't know the IP rights around that video.


They're on vimeo, but they were private


The loss of SkillsMatter has meant the loss of a lot of Clojure content online, unfortunately ๐Ÿ˜ž