What would be the most efficient way to get notified when results of a specific query have changed?
Clara computes query results upfront; when you call (query session ….) you’re basically just doing map lookups. https://github.com/cerner/clara-rules/blob/main/src/main/clojure/clara/rules/engine.cljc#L1998 So I don’t think different ways of doing this would have much difference in terms of performance; you’d probably want something that stores the previous state, calls query on the session, and then compares them.
I was thinking more in terms of getting notified per query only when the results changed. I'll look at doing it with a listener.