fire a rule only once (for the time being)

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

fire a rule only once (for the time being)

slyfox
It seems like there are many similar problems but I have not been able to find anything that addresses my issue exactly.  

I have a stock trading application, and I want to check if the price is out of a range (high,low)

if the price goes below low, the problem is the rule keeps firing if the price keeps going lower, this creates too much noise and overhead.  

I thought maybe the no-loop and duration attributes would help but they didnt.  

I know I could check not(Fired()) and use insert fired but I believe that spans the entire session which I do not want either.  

Is there a way to say fire this rule if true once then wait a period of time before I check again.

From what Ive read maybe agenda filters, but I am not sure if that is flexible enough.

Reply | Threaded
Open this post in threaded view
|

Re: fire a rule only once (for the time being)

slyfox
been thinking about this a lot.  I know the real solution is to use logical inserts but I'm wondering how it would work in my case.

The problem is that I may have several users with similar rules.  Again, its a financial app so if a user wants to know if a price breaks a certain threshold, say low for the day, ideally when that low is broken the fact should be removed.  However if I do that, would other user's rules ever fire (assuming they are looking for the same criteria)?

Would it be outrageous to create one session per user?  Is this a lot of overhead?
Reply | Threaded
Open this post in threaded view
|

Re: fire a rule only once (for the time being)

gboro54
I don't think it would be outrageous to build a stateful session per user. The expensive part is building the knowledge base. Session creation is cheap.

slyfox wrote
been thinking about this a lot.  I know the real solution is to use logical inserts but I'm wondering how it would work in my case.

The problem is that I may have several users with similar rules.  Again, its a financial app so if a user wants to know if a price breaks a certain threshold, say low for the day, ideally when that low is broken the fact should be removed.  However if I do that, would other user's rules ever fire (assuming they are looking for the same criteria)?

Would it be outrageous to create one session per user?  Is this a lot of overhead?