Hi

   The description you have bellow is ambiguous, so I can't give you a definitive answer. But it seems to be that you don't need sliding windows for that. Simple temporal operators will do.

> Secondly if the window is large and number of records coming in is high then could there be a memory issue?
   Yes, Drools does not manages persistence by itself. So, if your design must support more data than it would fit in your running environment memory, you need to design a solution that comprises persistence.

> Also since every record is getting stored in database, can I not use the database directly instead of sliding window?
   Yes, you can fetch data on demand from external sources, be it databases or anything else. Look at the "from" CE.

    []s
    Edson


2009/6/1 Bhushan Bhangale <bhushan_bhangale@kaleconsultants.com>

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.
bhushan_bhangale@kaleconsultants.com
tel: +91 (0)206 608 3777
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 

----------




_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users




--
 Edson Tirelli
 JBoss Drools Core Development
 JBoss, a division of Red Hat @ www.jboss.com