Fork me on GitHub

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


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": 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?


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


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


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


This will be cheap.


great, thanks!