Discussion:
[jboss-user] [jBPM] - how to use localtaskservice
yayu zhu
2013-04-29 09:10:45 UTC
Permalink
yayu zhu [https://community.jboss.org/people/a_alter] created the document:

"how to use localtaskservice"

To view the document, visit: https://community.jboss.org/docs/DOC-48631

--------------------------------------------------------------
i have a question about local taskservice.

will auto create human task info that in process to  database when i start a process?

Whether you can use jpa transaction manager?

In my test, i use jpa transaction.


Local Process session


*local task server*
*
*
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="
        http://www.springframework.org/schema/beans
        http://www.springframework.org/schema/beans/spring-beans-3.1.xsd">

    <bean id="systemEventListener" class="org.drools.SystemEventListenerFactory" factory-method="getSystemEventListener" />

    <bean id="internalTaskService" class="org.jbpm.task.service.TaskService">
        <property name="systemEventListener" ref="systemEventListener" />
    </bean>

    <bean id="htTxManager" class="org.drools.container.spring.beans.persistence.HumanTaskSpringTransactionManager">
        <constructor-arg ref="transactionManagerTask" />
    </bean>

    <bean id="springTaskSessionFactory" class="org.jbpm.task.service.persistence.TaskSessionSpringFactoryImpl" init-method="initialize"
        depends-on="internalTaskService">
        <property name="entityManagerFactory" ref="taskEmf" />
        <property name="transactionManager" ref="htTxManager" />
        <property name="useJTA" value="false" />
        <property name="taskService" ref="internalTaskService" />
    </bean>

    <bean id="taskService" class="org.jbpm.task.service.local.LocalTaskService" depends-on="springTaskSessionFactory">
        <constructor-arg ref="internalTaskService" />
    </bean>

</beans>  



Unit Test


   @Test
    public void testHumanTask() {
    Map<String, Object> map = new HashMap<String, Object>();
    map.put("employee", "a_alter");
    LocalHTWorkItemHandler humanTaskHandler = new LocalHTWorkItemHandler(service, session);
    humanTaskHandler.connect();
    session.getWorkItemManager().registerWorkItemHandler("Human Task", humanTaskHandler);
    session.startProcess("com.sample.evaluation", map);
    }


i find in startProcess, the human task will open a single session and ltaskservicesession addtask will not commit immidate, but the entitymanagerholder is shared.

at the last it will excute DroolsSpringTransactionManager commit; but the the session about humantask will not commit;

why? I  must need use JTA?

==============================

there is another question,  I'm not find how to working about Humantask'  workitemhandler. 

where i can find it?
--------------------------------------------------------------

Comment by going to Community
[https://community.jboss.org/docs/DOC-48631]

Create a new document in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=102&containerType=14&container=2034]
Loading...