4 Replies Latest reply on May 26, 2011 3:47 PM by connie.yang

    How to associate a custom WorkItemNodeHandler in a subprocess?

    connie.yang

      Hi,

       

      I have defined a parent workflow (using RuleFlowProcessFactory) that calls another process via subProcessNode in a for-each loop.  When I start the parent process, I register my WorkItemHandler with the WorkItemManager.

       

            ksession.getWorkItemManager().registerWorkItemHandler("myHandler",

                                                                new MyWorkItemHandler());

       

      MyWorkItemHandler is called (as expected) in all the WorkItemNode in the parent flow.  But yet, MyWorkItemHandler is not called in any of the WorkItemNode(s) in the subprocess.

       

      It seems to me that MyWorkItemHandler is not "global" in the parent and child processes.  Is there a way for me to make the subprocess "aware" of MyWorkItemHandler?

       

      Thanks for the help!

        • 1. Re: How to associate a custom WorkItemNodeHandler in a subprocess?
          salaboy21

          It should be global for all the ksession processes and sub processes are you sure that both of your processes define a service task with the taskName = "myHandler"

           

          ??

          Cheers

          • 2. Re: How to associate a custom WorkItemNodeHandler in a subprocess?
            connie.yang

            Yes.  I'm using the same text ("myHandler") in the subprocess WorkItemNode (s).

             

            Here's how I define the WorkItemNode in my subprocess,




            .workItemNode(6)




            .workName("myHandler")




            .workParameter(LcmConstants.LCM_SELECTOR, LockCommands.acquireLocksIfNeeded)




            .inMapping("arg0", "workingSet")



            .done()

             

            Thanks,

            Connie

            • 3. Re: How to associate a custom WorkItemNodeHandler in a subprocess?
              salaboy21

              Ok, could be a problem in the fluent API, because it's old and not updated. BTW what version of jBPM5 are you using?

              Did you try to do the same with XML BPMN 2 processes?

              Can you create a simple test that demonstrate the problem and share that with us?

              Greetings

              • 4. Re: How to associate a custom WorkItemNodeHandler in a subprocess?
                connie.yang

                We are using this set of jars,

                • jbpm-bpmn2-5.2.0-20110520.193755-3.jar, jbpm-workitems-5.2.0-20110520.193835-3.jar, jbpm-flow-5.2.0-20110521.000210-4.jar, jbpm-flow-builder-5.2.0-20110520.193310-4.jar, jbpm-persistence-jpa-5.2.0-20110521.000506-4.jar, jbpm-bam-5.2.0-20110520.193540-4.jar

                 

                Is it not recommended to use the fluent API to start a parent process and then spawn a subprocess?  Another way to start a subprocess is via WorkItemNode, but it's unclear to me if the engine is okay with nesting a process inside a task.  I'm considering giving this a try.  Any thoughts on that?

                 

                Also, I have tried the XML BPMN2 prior to using the fluent API, but quickly learned there's a learning curve that I don't quite have the time for right now.

                 

                I'll try to come up with a sample test that illustrates the problem.