cancel
Showing results for 
Search instead for 
Did you mean: 

unable to execute rule engine

trivedi
Champ in-the-making
Champ in-the-making
Hi All,

I have been trying to integrate Activiti with Drools, followed the approach what has been described in sample applications. But I couldn't get succeed, the rule is supposed to be fired for my test case, which is not happening. Can someone have quick glance and help me on this? I have spent almost a day on this.

Thanks,
Trivedi

P.S: The project is attached here for your reference.
8 REPLIES 8

frederikherema1
Star Contributor
Star Contributor
Hi,

I've tried to run your unittest (testDroolsPath) and it runs fine, console output:

Jun 28, 2011 9:39:59 AM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from class path resource [activiti.cfg.xml]
Jun 28, 2011 9:40:00 AM org.activiti.engine.impl.db.DbSqlSession executeSchemaResource
INFO: performing create on engine with resource org/activiti/db/create/activiti.h2.create.engine.sql
Jun 28, 2011 9:40:00 AM org.activiti.engine.impl.db.DbSqlSession executeSchemaResource
INFO: performing create on history with resource org/activiti/db/create/activiti.h2.create.history.sql
Jun 28, 2011 9:40:00 AM org.activiti.engine.impl.db.DbSqlSession executeSchemaResource
INFO: performing create on identity with resource org/activiti/db/create/activiti.h2.create.identity.sql
Jun 28, 2011 9:40:00 AM org.activiti.engine.impl.ProcessEngineImpl <init>
INFO: ProcessEngine default created
Jun 28, 2011 9:40:00 AM org.activiti.engine.impl.bpmn.deployer.BpmnDeployer deploy
INFO: Processing resource rejectionRules.drl
Jun 28, 2011 9:40:00 AM org.activiti.engine.impl.bpmn.deployer.BpmnDeployer deploy
INFO: Processing resource diagrams/InpatientReferral.bpmn20.xml
Jun 28, 2011 9:40:00 AM org.activiti.engine.impl.bpmn.parser.BpmnParse parseDefinitionsAttributes
INFO: XMLSchema currently not supported as typeLanguage
Jun 28, 2011 9:40:00 AM org.activiti.engine.impl.bpmn.parser.BpmnParse parseDefinitionsAttributes
INFO: XPath currently not supported as expressionLanguage
Jun 28, 2011 9:40:01 AM org.activiti.engine.impl.rules.RulesDeployer deploy
INFO: Processing resource rejectionRules.drl
Jun 28, 2011 9:40:03 AM org.activiti.engine.impl.rules.RulesDeployer deploy
INFO: Processing resource diagrams/InpatientReferral.bpmn20.xml
Starting Inpatient Referall process…..
com.gehcit.hsis.test.PatientDto@75157f77
Referral document is rejected
Started process instance id 6

trivedi
Champ in-the-making
Champ in-the-making
Hi ,

The test case runs well without any errors. But, it is supposed to execute the rule file, which is not happening. Just in case if it executes, then flow should end up with "MMA Referral Task" instead it is going to "Reject Document" node. One thing for sure is that the rule is not getting fired .

Thanks,
Trivedi

frederikherema1
Star Contributor
Star Contributor
Hi,

Aha, normally unit-tests we get fail to show what's wrong Smiley Wink
I see the rules-deployer kicking in, so the rules are picked up and the rule is present in the KnowledgeBase… But I think you should specify a rules-input if I'm not mistaken, you can't just use the variables of the executions by name.

trivedi
Champ in-the-making
Champ in-the-making
I don't think unit tests are capable of giving enough details about what is going wrong here. Is there a way i can increase the log level and see if something comes out? Also could you please elaborate on "specifying rules-input", I couldn't followed you that suggestion. I am a beginner in working on BPM tools.

Thanks,
Trivedi

frederikherema1
Star Contributor
Star Contributor
A unit-test could at least show me what output should be (like you said in the post after "flow should end up with "MMA Referral Task").

Everything you use in your in your business-rule task should be passed as input-variable (eg. order):

<businessRuleTask id="ruleTask" activiti:ruleVariablesInput="${order}" activiti:resultVariable="rulesOutput"/>

package org.activiti.rules.deploytest;

import org.activiti.standalone.rules.Order

rule "OrderItemCountZeroOrLess"
     when
        order : Order( itemCount <= 0)
     then
      order.setValid(false);         
end

rule "OrderItemCountGreaterThanZero"
     when
        order : Order( itemCount > 0)
     then
      order.setValid(true);          
end

trivedi
Champ in-the-making
Champ in-the-making
I really appreciate for your quick responses here. However, I tried your option in my example, it didn't worked. Were you able to get it working in sample that I attached? if so, please upload that sample that would helps me.

Thanks,
Trivedi

trivedi
Champ in-the-making
Champ in-the-making
Hi,

Could someone help me on this? or provide me some guidance on this?

Thanks,
Trivedi

trademak
Star Contributor
Star Contributor
Hi,

Just change the businessRuleTask definition to:

<businessRuleTask id="businessruletask1" name="Eligible Service" activiti:ruleVariablesInput="${patientDto}"></businessRuleTask>

Then the rules are executed.

Best regards,