clara

jherrlin 2021-10-05T16:01:02.020500Z

Hey! Im faily new to the rule engine concept and Clara. But having a great time with it! Made a bomberman clone with all of the game logic in Clara. https://github.com/jherrlin/bomberman-with-clara/blob/master/src/se/jherrlin/claraman/claraman_rules.cljc

jherrlin 2021-10-05T16:05:33.023300Z

My next quest is to use Clara on some complex business logic at work and I cant understand why some facts was inserted. How do you use to debug things like that? In Ryans talk (here: https://youtu.be/Z6oVuYmRgkk?t=1805) he shows a good looking page on the flow and how facts came to be. Is that tool publicly available?

ethanc 2021-10-05T16:15:08.026900Z

Clara Tools(https://github.com/rbrush/clara-tools) still exists however it is likely a little more than out of date. I believe that the inspect namespace provides some visibility, via listeners, as to what the session was doing: https://github.com/cerner/clara-rules/blob/main/src/main/clojure/clara/tools/inspect.cljc I personally haven’t had too much time to make my own tooling around the listeners, but in theory most things should be possible. The Listeners should be provided with a wealth of information about what operations the session is going through.

jherrlin 2021-10-05T16:22:21.027700Z

Thx @ethanc for pointing them out!

jherrlin 2021-10-05T16:24:13.029Z

So it would be doable to hook up for example a websocket and stream what the session is doing?

ethanc 2021-10-05T16:29:44.031200Z

If you were to write a custom listener, then i would imagine that the listener would be able to send data. Though the aggregation and display of the data would probably be the more fiddly bit. Listeners themselves are pretty basic: https://github.com/cerner/clara-rules/blob/main/src/main/clojure/clara/tools/internal/inspect.cljc#L1

👍 1
jherrlin 2021-10-05T16:35:34.031900Z

Okey! Thanks! Ill look into it and see what happens