JBoss Community

JBPM5 - Human task not getting completed

created by vmaroli in jBPM Development - View the full discussion

I am trying out a sample process with a human task. Configured persistence for both Task server and process instnace in postgresql. Process flow is stopping at the human task as expected. After this I am completing the task using a human task client. Problem is that after this the process is not proceeding to complete. I am using JPAKnowledgeService and CommandBasedWSHumanTaskHandler. Is there anything additional need to be done for completing the process another than invoking the task api at task server ?


Is there any significance to the task name & name we give to the Human Task in the process ?


Code used for starting process.



        Logger logger = Logger.getLogger(this.getClass().getName());
        Environment env = KnowledgeBaseFactory.newEnvironment();
        env.set( EnvironmentName.ENTITY_MANAGER_FACTORY, emf );
        env.set(EnvironmentName.GLOBALS, new MapGlobalResolver());
        env.set(EnvironmentName.TRANSACTION_MANAGER, TransactionManagerServices.getTransactionManager());
        logger.info("Loading process definition");
        KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
        kbuilder.add(ResourceFactory.newClassPathResource(processDefinition), ResourceType.BPMN2);
        kbase = kbuilder.newKnowledgeBase();
        Properties properties = new Properties();
        properties.put("drools.processInstanceManagerFactory", "org.jbpm.persistence.processinstance.JPAProcessInstanceManagerFactory");
        properties.put("drools.processSignalManagerFactory", "org.jbpm.persistence.processinstance.JPASignalManagerFactory");
        KnowledgeSessionConfiguration config = KnowledgeBaseFactory.newKnowledgeSessionConfiguration(properties);
        logger.info("create session");
        ksession = JPAKnowledgeService.newStatefulKnowledgeSession( kbase, config, env );
        int sessionId = ksession.getId();
        logger.info("Session Id : "+sessionId);
        logger.info("Registering Human Task listener");
        CommandBasedWSHumanTaskHandler cbHandler = new CommandBasedWSHumanTaskHandler(ksession);
        ksession.getWorkItemManager().registerWorkItemHandler("Human Task", cbHandler);


Human Task Service


public class HumanTaskService {
    private TaskService taskService = null;
    private TaskServiceSession taskSession = null;
    public HumanTaskService(EntityManagerFactory emFactory) {
        Logger logger = Logger.getLogger(this.getClass().getName());
        logger.info("Initializing Human Task Service");
        SystemEventListener systemEventListener = SystemEventListenerFactory.getSystemEventListener();
        taskService = new TaskService(emFactory, systemEventListener);
        taskSession = taskService.createSession();
        taskSession.addUser(new User("Administrator"));
    public void addUser(String userId) {
        Logger logger = Logger.getLogger(this.getClass().getName());
        logger.info("Adding user "+userId);
        taskSession.addUser(new User(userId));
    public void startTaskService() {
        Logger logger = Logger.getLogger(this.getClass().getName());
        logger.info("Starting Human Task Service");
        MinaTaskServer server = new MinaTaskServer( taskService );
        Thread thread = new Thread( server );

Reply to this message by going to Community

Start a new discussion in jBPM Development at Community