The instance is transferred from: http://blog.csdn.net/quzishen/article/details/6163012
Easy to understand application Example 1:
Now we are simulating an application scenario: a site that is associated with a business-generated point issuance operation. such as Alipay credit card repayment bonus points.
Issuance points may be accompanied by different operating strategies and seasonal adjustments, the number and rules of issuance are completely different, if the use of hard-coded to accompany the business adjustment and modification, code modification, management, optimization, testing, on-line will be a very troublesome thing, so, the release rules are extracted, to drools management, Can solve this problem to a great extent.
(Note that not all rules-related content is recommended to use Drools, which is to consider how long the system will run, change the frequency of rules and other conditions, if your system will only run a week online, there is no need to choose Drools to increase your development costs, Java hard-coded way will be preferred)
We define the issuance rules:
points for the distribution of reference factors are: the number of transactions, the number of transactions, credit card repayment times, birthday special offers and so on.
To define a rule:
Birthday, then add 10 points, and the current month to double the number of transactions before calculating points
2011-01-08-2011-08-08 Monthly credit card repayment more than 3 times, each full 3 gift 30 points
Monthly purchase of more than 100 of the total amount, every 100 yuan free 10 points
Purchase more than 5 times in the month, give 50 points every five times
In particular, if all the requirements are met, an additional bonus of 100 points
Return, deduction of 10 points
Return amount greater than or equal to 100, deduction of 100 points
According to these rules, we let drools automatically calculate for us the number of points issued for a particular user.
Source: Https://github.com/XBWer/DroolsDemo
Another example--QQ level acceleration
Accelerates according to a series of acceleration rules.
If you had any questions about this article, welcome to leave a message on the message board.
Brad (Bowen Xu)
E-mail:max_xbw@163.com