[rules-users] Drools and event based decisions, i.e. streaming market quotes

Henry Canterburry canterburry at gmail.com
Thu Jan 17 14:25:02 EST 2008


What would be the best approach using drools to handle event driven 
decisions based on streaming data? In my case I am looking for a typical 
stock market scenario. Ticker quotes usually come in at second 
increments and depending on how many ticker symbols you subscribe to at 
any one time, there can be a lot of data coming and and changing every 
second. However, there probably isn't a need to keep large quantities of 
historic data in memory...maybe the last 200-500 ticks. The outputs are 
if a stock should be sold or bought, at what quantity and what price. 
Once the decision has been made, we need to make sure it does not 
persist past the point of being valid given the state of that data.

If I have rules that are meant to derive/calculate info and decisions 
from the streaming data, what is the best integration architecture for 
the rule engine with the rest of the application?

Stateful session which constantly updates the ticks in working memory 
and queries the memory for results on an ongoing basis? In this case, 
the session would be kept alive for as long as the data stream is going 
(i.e. hours)? This approach would require very rigorous working memory 
management and all the objects in it.

Or...loop constantly over a stateless session for each tick? This would 
reduce the need to manage the number of objects in working memory since 
only the amount needed would be inserted in the first place and read 
back the results? Sounds inefficient and with lots of overhead.

Also, what about multi-threaded environments? Any potential for 
conflicts between concurrent session instances?

Thanks
HC





More information about the rules-users mailing list