Representing and executing simple rules - framework or custom?
- by qtips
I am creating a system where users will be able to subscribe to events, and get notified when the event has occured. Example of events can be phone call durations and costs, phone data traffic notations, and even stock rate changes.
Example of events:
customer 13532 completed a call with duration 11:45 min and cost $0.4
stock rate for Google decreased with 0.01%
Customers can subscribe to events using some simple rules e.g.
When stock rate of Google decreases more than 0.5%
When the cost of a call of my subscription is over $1
Now, as the set of different rules is currently predefined, I can easily create a custom implemention that applies rules to an event. But if the set of rules could be much larger, and if we also allow for custom rules (e.g. when stock rate of Google decreses more than 0.5% AND stock rate of Apple increases with 0.5%), the system should be able to adapt. I am therefore thinking of a system that can interpret rules using a simple grammer and then apply them.
After som research I found that there exists rule-based engines that can be used, but I am unsure as they seem too complicated and may be a little overkill for my situation.
Is there a Java framework suited for this area? Should we use framework, a rule engine, or should we create something custom? What are the pros and cons?