]
Mark Proctor commented on JBRULES-1944:
---------------------------------------
I've impl the whole enchalada, hope you are happy :)
Adding crontab type functionality for repetitive rules.
-------------------------------------------------------
Key: JBRULES-1944
URL:
https://jira.jboss.org/jira/browse/JBRULES-1944
Project: Drools
Issue Type: Feature Request
Security Level: Public(Everyone can see)
Components: drools-api
Affects Versions: FUTURE
Reporter: Griz frf
Assignee: Mark Proctor
A convinient helper function to schedule rule executions in a similar manner to the cron
utility would be useful.
My specific use case is for a long running session to periodically write out data to a
persistence store (db, file, etc)
The current code for this is as follows :
rule "DBpoll"
duration(30s)
when $d:String(toString=="Run")
then
System.out.println("30seconds elapsed");
Database.dosomething();
modify($d){};
end
--------------------------------
session.insert(new String("Run"));
---------------------------------
While this method does work, it requires the external dummy object trigger. In
dynamically generated rules and rules pulled in from libraries, etc (not under the current
developers control) it is difficult to ensure that a suibtable trigger is available.
Therefore a cron like function would solve this issue.
I envision the EVERY keyword and possibly a COUNT or for loop style format
rule "DBpoll"
EVERY(30s, 100) <-- means every 30 seconds for 100 iterations. or EVERY(30s, 10m)
<-- every 30 seconds for 10 mins
then
System.out.println("30seconds elapsed");
Database.dosomething();
end
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: