Representing and executing simple rules - framework or custom?

Posted by qtips on Programmers See other posts from Programmers or by qtips
Published on 2013-10-25T09:14:17Z Indexed on 2013/10/25 10:11 UTC
Read the original article Hit count: 364

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?

© Programmers or respective owner

Related posts about java

Related posts about rules-and-constraints