clara

http://www.clara-rules.org/
2019-10-06T15:31:45.011700Z

Are clara sessions intended as throwaway cheap things meant to replace an elaborate cond? I have a long running process that receives events every few seconds, and needs to make decisions based mainly on that new data point, and to a lesser extent some previous, accumulating state, but not previous events in the stream. Which one is the default approach with clara: a new session for each new data point, adding in the needed extra state with insert? Or should I be building up one session over time and retracting the old/unused data points

2019-10-06T15:44:06.013700Z

Put slightly differently, the "sensors" example in the clara-examples repo seems similar to what i'm trying to do, but I'm not quite sure how the main function would translate to the "real world": https://github.com/cerner/clara-examples/blob/master/src/main/clojure/clara/examples/sensors.clj#L87 Should the same session persist throughout the long-running process that provides the sensor data? Or is the run-examples function similar to something that would be called frequently in response to new data?

2019-10-06T16:39:52.014500Z

@jjttjj you could certainly create one “base session” and hold a reference to it

2019-10-06T16:40:12.015200Z

Then do insert+fire on independent “branches” from there. In isolation

2019-10-06T16:40:46.016300Z

If old state doesn’t need to influence “new” you don’t need to try retracting the last cycle of facts etc. just start from scratch again from the base session

2019-10-06T16:40:54.016600Z

This will be cheap.

2019-10-06T16:43:30.016900Z

great, thanks!

👍 1