[rules-users] Basic question
Wolfgang Laun
wolfgang.laun at gmail.com
Sun Apr 7 04:11:30 EDT 2013
At least rule "Rating", as shown, isn't the one you've actually been
using - it wouldn't even compile. Please post actual, unmodified code
- or don't post at all.
-W
On 07/04/2013, goforcrazy <goforcrazy at gmail.com> wrote:
> Hello All,
>
> I am having some basic problems with how my rule file is working. Any help
> regarding this will be greatly appreciated.
>
> My rule is as follows:
>
> rule "Rating"
>
> when
> m : method()
> then
> System.out.println("Rating inserted as: "+ m.getid() + " and rating: " +
> m.getRating());
>
> end
>
>
> In my main java file, I am calling in the main method:
>
> insertRating(101, 1.0);
> insertRating(102, 1.0);
> ksession.fireAllRules();
>
>
> The definition of insertRating is as below:
> public void insertRating(int mid, double d)
> {
> RatingMessage msg = new RatingMessage(mid,d);
> ksession.insert(msg);
>
> }
>
> My expectation is that 2 different ksession objects will be created and
> when
> fireAllRules() is executed, the rule will be able to print the ID and
> rating
> for both 101 and 102.
>
> I am surprised that the output is
> Rating inserted ID as: 101 and rating: 1.0
>
>
> It randomly takes either 101 or 102 and never both. Why is it so? Am I
> missing something?
>
> Thanks a million for the help:)
>
>
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/Basic-question-tp4023234.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
>
More information about the rules-users
mailing list