4 Replies Latest reply on Oct 19, 2016 5:51 AM by amoolya da

    Help for creating async task in jBPM 6 using eclipse.

    Rahul Magdum Novice

      Hi,

      I want to execute following bpmn process which has async task.

      Is it necessary to write work item handler for async task?
      beacause while running this project i got this exception

      Caused by: org.drools.core.WorkItemHandlerNotFoundException: Could not find work item handler for async

       

      How to register async task work item handler?

      CommandClass = org.jbpm.examples.cmd.UserCommand

       

       

       

       

      i have following files in project

      1) main process

      package org.jbpm.examples.main;

       

       

      import java.util.HashMap;

      import java.util.Map;

      import java.util.Properties;

       

       

      import org.kie.api.io.ResourceType;

      import org.kie.api.runtime.process.ProcessInstance;

      import org.kie.api.runtime.process.WorkItemManager;

      import org.kie.internal.KnowledgeBase;

      import org.kie.internal.builder.KnowledgeBuilder;

      import org.kie.internal.builder.KnowledgeBuilderFactory;

      import org.kie.internal.io.ResourceFactory;

      import org.kie.internal.runtime.StatefulKnowledgeSession;

      import org.jbpm.*;

      import org.jbpm.executor.impl.ExecutorImpl;

      import org.jbpm.examples.cmd.UserCommand;

      import org.jbpm.examples.data.User;

       

      public class ProcessMain {

        public static void main(String[] args) {

       

        KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();

       

        int choice = 1;

       

        switch(choice){

        case 1:

       

        kbuilder.add(ResourceFactory.newClassPathResource("async_test_01.bpmn"), ResourceType.BPMN2);

        KnowledgeBase kbase = kbuilder.newKnowledgeBase();

        StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();

       

        //--------------------------------------------

        User user = new User("Rahul",22);

        Map<String,Object> params = new HashMap<String,Object>();

        params.put("user",user);

        params.put("command", "org.jbpm.examples.cmd.UserCommand");

        //-------------------------------------------

       

        ProcessInstance process= ksession.startProcess("org.jbpm.examples.bpmn.async_test_01",params);

        break;

        }

        }

      }

       

      2) bpmn process

      attached