Dmitry Erkin
2013-01-05 18:20:40 UTC
Dmitry Erkin [https://community.jboss.org/people/dmitry.erkin] created the discussion
"Can not fire a rule"
To view the discussion, visit: https://community.jboss.org/message/787997#787997
--------------------------------------------------------------
Hello!
Here is my first JBPM sample process whose purpose is to fire the simple rule:
<process processType="Private" isExecutable="true" id="com.sample.bpmn" name="Sample Process" tns:packageName="defaultPackage" >
   <extensionElements>
    <tns:import name="defaultPackage.Person" />
   </extensionElements>
   <!-- process variables -->
   <property id="p" itemSubjectRef="_pItem"/>
   <!-- nodes -->
   <startEvent id="_1" name="StartProcess" />
   <endEvent id="_3" name="End" >
       <terminateEventDefinition />
   </endEvent>
   <scriptTask id="_4" name="Create new person" scriptFormat=" http://www.java.com/java http://www.java.com/java" >
     <script>*p = new Person("john", 19);*</script>
   </scriptTask>
   <scriptTask id="_6" name="Add the fact that new person is created" scriptFormat=" http://www.java.com/java http://www.java.com/java" >
     <script>*kcontext.getKnowledgeRuntime().insert(p);*
</script>
   </scriptTask>
   <businessRuleTask id="_7" name="Fire rules" g:ruleFlowGroup="*test*" >
   </businessRuleTask>
   <!-- connections -->
   <sequenceFlow id="_7-_3" sourceRef="_7" targetRef="_3" />
   <sequenceFlow id="_1-_4" sourceRef="_1" targetRef="_4" />
   <sequenceFlow id="_4-_6" sourceRef="_4" targetRef="_6" />
   <sequenceFlow id="_6-_7" sourceRef="_6" targetRef="_7" />
 </process>
Here is the simple rule which is supposed to be fired:
package defaultPackage
rule "test.Rule1"
ruleflow-group "*test*"
   when
       $p : Person()
   then
       System.out.println( "Person " + $p );
end
Nothing hapens when I start an instance of my sample process. I mean the server log does not have "Person " string.
What is wrong with my sample?
Regards,
Dmitry Erkin
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/787997#787997]
Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
"Can not fire a rule"
To view the discussion, visit: https://community.jboss.org/message/787997#787997
--------------------------------------------------------------
Hello!
Here is my first JBPM sample process whose purpose is to fire the simple rule:
<process processType="Private" isExecutable="true" id="com.sample.bpmn" name="Sample Process" tns:packageName="defaultPackage" >
   <extensionElements>
    <tns:import name="defaultPackage.Person" />
   </extensionElements>
   <!-- process variables -->
   <property id="p" itemSubjectRef="_pItem"/>
   <!-- nodes -->
   <startEvent id="_1" name="StartProcess" />
   <endEvent id="_3" name="End" >
       <terminateEventDefinition />
   </endEvent>
   <scriptTask id="_4" name="Create new person" scriptFormat=" http://www.java.com/java http://www.java.com/java" >
     <script>*p = new Person("john", 19);*</script>
   </scriptTask>
   <scriptTask id="_6" name="Add the fact that new person is created" scriptFormat=" http://www.java.com/java http://www.java.com/java" >
     <script>*kcontext.getKnowledgeRuntime().insert(p);*
</script>
   </scriptTask>
   <businessRuleTask id="_7" name="Fire rules" g:ruleFlowGroup="*test*" >
   </businessRuleTask>
   <!-- connections -->
   <sequenceFlow id="_7-_3" sourceRef="_7" targetRef="_3" />
   <sequenceFlow id="_1-_4" sourceRef="_1" targetRef="_4" />
   <sequenceFlow id="_4-_6" sourceRef="_4" targetRef="_6" />
   <sequenceFlow id="_6-_7" sourceRef="_6" targetRef="_7" />
 </process>
Here is the simple rule which is supposed to be fired:
package defaultPackage
rule "test.Rule1"
ruleflow-group "*test*"
   when
       $p : Person()
   then
       System.out.println( "Person " + $p );
end
Nothing hapens when I start an instance of my sample process. I mean the server log does not have "Person " string.
What is wrong with my sample?
Regards,
Dmitry Erkin
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/787997#787997]
Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]