[rules-users] rule using sliding window
Bhushan Bhangale
bhushan_bhangale at kaleconsultants.com
Mon Jun 1 06:48:34 EDT 2009
I am using Drools 5. I am struggling to write rule for this logic -
If a stock price changes more than 10% within an hour then report the
change.
I understand I have to use sliding window feature but unable to write the
rule.
For example I got an update for IBM stock @ 12:30 for price 100 and then
another update IBM stock @ 12:35 for price 111. Since the time difference is
within an hour and the change is also greater than 10% I want to report this
price change.
Stock class -
Public class Stock {
Private String stock;
Private double price;
Private Date time;
Private double priceChange;
Private Boolean highlight;
}
rule "Stock Price change more than 10% within an hour"
when
then
set the priceChange attribute of Stock object
set highlight to true
end
Secondly if the window is large and number of records coming in is high then
could there be a memory issue?
Also since every record is getting stored in database, can I not use the
database directly instead of sliding window?
Thanks
Mr. Bhangale Bhushan
Associate Manager
Kale Consultants Ltd.
<mailto:bhushan_bhangale at kaleconsultants.com>
bhushan_bhangale at kaleconsultants.com
tel:
<http://www.plaxo.com/click_to_call?lang=en&src=jj_signature&To=%2B91+%280%2
9206+608+3777&Email=bhushan_bhangale at kaleconsultants.com> +91 (0)206 608
3777
<http://www.kaleconsultants.com> http://www.kaleconsultants.com
Disclaimer: This email (including any attachments) is intended for the sole
use of the recipient/s and may contain material that is CONFIDENTIAL. Any
unauthorized disclosure / copying / distribution or forwarding of this message
or part is STRICTLY PROHIBITED. If you have erroneously received this message,
please delete it immediately and notify the sender. No liability is assumed for
any errors and/or omissions in the contents of this message. Information in
this message that does not relate to the official business of this Company
shall be understood as neither given nor endorsed by it. If verification is
required please request a hard-copy version.
To know more about Kale Consultants, visit www.kaleconsultants.com
-=-=-=-=-=-=-=-=-=-
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20090601/dbdb746f/attachment.html
More information about the rules-users
mailing list