1 Reply Latest reply on Mar 17, 2016 5:15 AM by Abhijit Humbe

    How to create multiple workitemhandler for human task ?

    Amol Shankar Newbie

      I am defining a process having two user tasks and I am creating two workitemhandler for both tasks and registering them but only one is getting called.


      public class StartProcess {

      /**

      * @param args

      */

      @SuppressWarnings("restriction")

      public static void main(String[] args) {

      KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();

      kbuilder.add( ResourceFactory.newClassPathResource("trial.bpmn"),

                    ResourceType.BPMN2 );

      KnowledgeBase kbase = kbuilder.newKnowledgeBase();

      StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();

       

       

      ksession.getWorkItemManager().registerWorkItemHandler("Human Task",new UserTask_1());

      ksession.getWorkItemManager().registerWorkItemHandler("Human Task",new UserTask_2());

       

      ProcessInstance processInstance=ksession.startProcess("com.sample.bpmn");

      }

       

       

      here I have two WorkItemHandler named UserTask_1 and UserTask_2.But only UserTask_2 is getting called for both usertasks.