[rules-users] When I insert fact to working memery in the rule file, others rule some time can't be fired.

Michael Anstis michael.anstis at gmail.com
Fri Nov 11 03:27:55 EST 2011


Do you insert a User Fact too?

Perhaps seeing the Java side of your code will help.

On 11 November 2011 08:18, luke <lzz313 at sina.com> wrote:

> Hi,
>
> When I insert fact to working memery in the rule file, others rule some
> time
> can't be fired.
>
> I use the drools rule version is 5.3.0.Final
>
> call rule engine in java and loop 100,then has 1-3 times the "second" rule
> and "third" rule can't be fired.
>
> rule file:
> package com.sample
>
> import com.sample.pojo.Order
> import com.sample.pojo.User
> import com.sample.pojo.Item
>
> declare ActivityType
>        orderId : String
>        name : String
>        type : String
> end
>
>
> rule "first"
>        no-loop true
>        salience 100
>    when
>    $user:User()
>        $order:Order(userId ==
> $user.id
> ,server=="server",operator=="operator",gameName=="gameName",createdDt
> > "2011-11-01",createdDt < "2011-11-30",points >= 240)
>    not Order(userId == $user.id,id != $order.id)
>    then
>    drools.insert(new ActivityType($order.getId(),"first","S"));
>    System.out.println("inserted activity type,"+"
> orderId="+$order.getId());
> end
>
> rule "second"
>        salience 2
>    when
>        $activityType : ActivityType(name == "first",type == "S")
>        $order:Order(id == $activityType.orderId,points == 240,amount >= 10)
>    $user:User(id == $order.userId)
>    then
>        $user.setItem(new Item("aaa",1));
> end
>
> rule "third"
>        salience 1
>        when
>                $activityType : ActivityType(name == "first", type == "S")
>                $order:Order(points == 240, id == $activityType.orderId)
>                $user:User(id == $order.userId)
>        then
>                $user.setItem(new Item("aaa",1*$order.getQuality()));
> end
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/When-I-insert-fact-to-working-memery-in-the-rule-file-others-rule-some-time-can-t-be-fired-tp3499083p3499083.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20111111/ea5bcd79/attachment.html 


More information about the rules-users mailing list