Uploaded image for project: 'JBRULES'
  1. JBRULES
  2. JBRULES-2728

Ruleflow works in 5.0.1.but not in 5.1.0 (or 5.1.1)

This issue belongs to an archived project. You can view it, but you can't modify it. Learn more

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • Major
    • 5.2.0.M2
    • 5.1.0.FINAL, 5.1.1.FINAL
    • drools-core (flow)
    • None
    • Hide

      This is the DRL file (InitRules.drl):

      package drools.bug;
      import drools.bug.DroolsHelper;
      rule "init ruleflow"
      salience 100
      when
      then
      System.err.println("init ruleflow fired...");
      drools.getWorkingMemory().startProcess("RuleFlow");
      end
      rule "01009"
      ruleflow-group "GeneralRules"
      lock-on-active
      when
      then
      System.err.println("rule 01009 fired...");
      end

      and this is the RF file (RuleFlow.rf):

      <?xml version="1.0" encoding="UTF-8"?>
      <process xmlns="http://drools.org/drools-5.0/process"
      xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
      xs:schemaLocation="http://drools.org/drools-5.0/process drools-processes-5.0.xsd"
      type="RuleFlow" name="RuleFlowName" id="RuleFlow" package-name="drools.bug" version="0.1" >

      <header>
      </header>

      <nodes>
      <start id="1" name="Start" x="363" y="100" width="48" height="48" />
      <end id="2" name="End" x="364" y="502" width="48" height="48" />
      <ruleSet id="3" name="InitName" x="348" y="176" width="80" height="48" ruleFlowGroup="Init" />
      <ruleSet id="4" name="General Rules Name" x="348" y="255" width="80" height="48" ruleFlowGroup="GeneralRules" />
      </nodes>

      <connections>
      <connection from="4" to="2" />
      <connection from="1" to="3" />
      <connection from="3" to="4" />
      </connections>

      </process>

      The ruleSet.xml file contains references to these two files:
      <?xml version="1.0" encoding="UTF-8"?>
      <change-set xmlns='http://drools.org/drools-5.0/change-set'
      xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
      xsi:schemaLocation="http://drools.org/drools-5.0/change-set"
      >

      <add>
      <resource source='classpath:InitRules.drl' type='DRL' />
      <resource source='classpath:RuleFlow.rf' type='DRF' />
      </add>
      </change-set>

      And here is the Java main method:

      public static void main(String[] args) {
      try

      { KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder(); InputStream isRuleSet = DroolsBugExample.class.getResourceAsStream("/ruleSet.xml"); kbuilder.add(ResourceFactory.newInputStreamResource(isRuleSet), ResourceType.CHANGE_SET); KnowledgeBase kb = KnowledgeBaseFactory.newKnowledgeBase(); kb.addKnowledgePackages(kbuilder.getKnowledgePackages()); StatelessKnowledgeSession session = kb.newStatelessKnowledgeSession(); List<Command<?>> commands = new ArrayList<Command<?>>(); commands.add(CommandFactory.newFireAllRules()); Command<?> batchCommand = CommandFactory.newBatchExecution( commands ); session.execute( batchCommand ); }

      catch (Exception e)

      { e.printStackTrace(); }

      }

      Running with Drools 5.0.1, the rule "init ruleflow" starts (as expected) another rule ("01009"). However, if Drools 5.1.1 (or 5.1.0) is used, the rule "01009" will not be fired.

      Show
      This is the DRL file (InitRules.drl): package drools.bug; import drools.bug.DroolsHelper; rule "init ruleflow" salience 100 when then System.err.println("init ruleflow fired..."); drools.getWorkingMemory().startProcess("RuleFlow"); end rule "01009" ruleflow-group "GeneralRules" lock-on-active when then System.err.println("rule 01009 fired..."); end and this is the RF file (RuleFlow.rf): <?xml version="1.0" encoding="UTF-8"?> <process xmlns="http://drools.org/drools-5.0/process" xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:schemaLocation="http://drools.org/drools-5.0/process drools-processes-5.0.xsd" type="RuleFlow" name="RuleFlowName" id="RuleFlow" package-name="drools.bug" version="0.1" > <header> </header> <nodes> <start id="1" name="Start" x="363" y="100" width="48" height="48" /> <end id="2" name="End" x="364" y="502" width="48" height="48" /> <ruleSet id="3" name="InitName" x="348" y="176" width="80" height="48" ruleFlowGroup="Init" /> <ruleSet id="4" name="General Rules Name" x="348" y="255" width="80" height="48" ruleFlowGroup="GeneralRules" /> </nodes> <connections> <connection from="4" to="2" /> <connection from="1" to="3" /> <connection from="3" to="4" /> </connections> </process> The ruleSet.xml file contains references to these two files: <?xml version="1.0" encoding="UTF-8"?> <change-set xmlns='http://drools.org/drools-5.0/change-set' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:schemaLocation="http://drools.org/drools-5.0/change-set" > <add> <resource source='classpath:InitRules.drl' type='DRL' /> <resource source='classpath:RuleFlow.rf' type='DRF' /> </add> </change-set> And here is the Java main method: public static void main(String[] args) { try { KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder(); InputStream isRuleSet = DroolsBugExample.class.getResourceAsStream("/ruleSet.xml"); kbuilder.add(ResourceFactory.newInputStreamResource(isRuleSet), ResourceType.CHANGE_SET); KnowledgeBase kb = KnowledgeBaseFactory.newKnowledgeBase(); kb.addKnowledgePackages(kbuilder.getKnowledgePackages()); StatelessKnowledgeSession session = kb.newStatelessKnowledgeSession(); List<Command<?>> commands = new ArrayList<Command<?>>(); commands.add(CommandFactory.newFireAllRules()); Command<?> batchCommand = CommandFactory.newBatchExecution( commands ); session.execute( batchCommand ); } catch (Exception e) { e.printStackTrace(); } } Running with Drools 5.0.1, the rule "init ruleflow" starts (as expected) another rule ("01009"). However, if Drools 5.1.1 (or 5.1.0) is used, the rule "01009" will not be fired.

    Description

      Ruleflow works in 5.0.1.but not in 5.1.0 (or 5.1.1), see Steps to Reproduce for more details.

      Attachments

        Issue Links

          Activity

            People

              kverlaen@redhat.com Kris Verlaenen
              anton.vasko Anton Vasko (Inactive)
              Archiver:
              rhn-support-ceverson Clark Everson

              Dates

                Created:
                Updated:
                Resolved:
                Archived:

                PagerDuty