[rules-users] Rules not firing when facts asserted in a rule RHS in 5.0

Chris Selwyn chris at selwyn-family.me.uk
Wed Dec 1 05:13:57 EST 2010


I have been using the open source Drools 5.1 where I have been inserting 
facts in the RHS of a rule and that has been causing subsequent rules to 
fire just fine.

However, I am working at a customer that requires my to use a supported 
product, so I have moved my rules over to JBoss Rules 5.0.2 and I find 
that this does not work any more.

I have a declarative fact type as follows
declare QuestionValidation
     question: String
     state: String
     mandatory: Boolean
     type: String
end

I have an "init" rule with high salience that inserts a number of 
QuestionValidations into the session.

In order to test what is going on, I created a rule:-
rule 'Test'
dialect 'mvel'
when
     $qv: QuestionValidation()
then
     System.out.println( "QuestionValidation found " + $qv.getQuestion() 
+ "/" + $qv.getState() );
end

This rule never fires if I insert a QuestionValidation in the init rule!

I can see the facts being inserted in the log as follows
[#|2010-12-01T09:19:16.723+0000|INFO|sun-appserver2.1|javax.enterprise.system.stream.out|_ThreadID=70;_ThreadName=p: 
thread-pool-1; w: 7;|
OBJECT ASSERTED value:QuestionValidation( mandatory=true, state=Closed, 
question=B2B_METER_SERIAL_NUMBER, type=string ) factId: 39|#]

But I don't see any associated "ACTIVATION CREATED" for this object.

However, if I insert a QuestionValidation fact created in Java by using 
kbase.getFactType("SWWB2BOutgoing", "QuestionValidation") then the Test 
rule gets fired just fine.

Is there something I am missing? Do I need to to turn on rule chaining 
or something like that? (Surely chaining is on by default).

Chris



More information about the rules-users mailing list