2 Replies Latest reply on Jan 13, 2012 3:24 AM by Esteban Aliverti

    can i use rule task in embedded sub-process?

    hardawaycg Newbie

      i want to keep all my java code in drl file,so i dont want to use script task but rule task ,i can put those java code in RHS in rule

      when i place a script task in embedded sub-process and write java code in action,it works.but when i replace the script task as a rule task,it doesn't work,why?




        • 1. Re: can i use rule task in embedded sub-process?
          hardawaycg Newbie

          sorry,after kinds of test,i found this is not because of embedded sub-process,but signal event.


          rule task doesn't work on a flow file if these is signal event,this is my test case:


          scene1: just like below,it works:


          with java code like this,the console print run,it works.

          ProcessInstance process = ksession.startProcess("test2Flow");


                                        ksession.signalEvent("event1", null,process.getId());


          1、replace the script task with a rule task,and set ruleflowgroup as sub1


          2、create a drl file and write a rule name "rule1":

          rule "rule1"

                    ruleflow-group "sub1"






          3、add the drl resource on java code ,then run code like before.

          the result is console print nothing ? why ?

          • 2. Re: can i use rule task in embedded sub-process?
            Esteban Aliverti Master

            According to the information you have exposed, I can state this: After you call ksession.signalEven(), the process continues its execution and reaches the Rule Task node. At this point, the rule is activated (check the output log to check this) and the process execution stops returning to the line after ksession.signalEvent(). At this point you need to tell the session to execute all activated rules: ksession.fireAllRules(). When fireAllRules() gets executed, the process execution continues and reaches the end node.