0 Replies Latest reply on Feb 1, 2016 2:56 PM by CHRISTIAN TASSIN

    [JBPM + JAVA] Parallel Process Service & slow complete Work Item action



      I am developing a software to manage flow on items, and i have some trouble with performance and parallel process.



      • The flow is very simple, it will check date and some parameters and use boolean check to decide what is the next step. I have only 5 tasks in my flow.



      • Java SE 6
      • Spring v4 + hibernate + Atomikos XA
      • DB2 database v10 + MQ
      • JBPM v6.3


      What i want to do:

      • All items are independent. So i would like to start n Threads on the same instance and launch parallel process at the same time.



      • I am using scope="prototype" on each beans that is part of independent thread. My runtime manager is configured with "PER_PROCESS_INSTANCE".
      • All independent threads get item to process, and launch a process.


      My problems:

      • I can see with logs that all threads want to launch process in parallel. But there is only one process started at the same time.
      • I have another problem with the method complete work item. This took more than 100ms and i doesn't understand why.


      Thank you in advance for your help or hints.


      My xml configuration:


      <bean id="taskService" class="org.kie.spring.factorybeans.TaskServiceFactoryBean"
              <property name="entityManagerFactory" ref="bpmEMF" />
              <property name="transactionManager" ref="jtaTransactionManager" />
              <property name="listeners">
                      <bean class="org.jbpm.services.task.audit.JPATaskLifeCycleEventListener">
          <bean id="customLogFactory" class="expertus.workflowengine.flowworker.utils.CustomLogFactory" />
          <bean id="process" factory-method="newClassPathResource"
          <bean id="runtimeEnvironment"
              <property name="type" value="DEFAULT" />
              <!--<property name="registerableItemsFactory" ref="customLogFactory" />-->
              <property name="entityManagerFactory" ref="bpmEMF" />
              <property name="transactionManager" ref="jtaTransactionManager" />
              <property name="assets">
                      <entry key-ref="process">
                          <util:constant static-field="org.kie.api.io.ResourceType.BPMN2" />
              <property name="taskService" ref="taskService" />
          <bean id="runtimeManager" class="org.kie.spring.factorybeans.RuntimeManagerFactoryBean"
              <property name="type" value="PER_PROCESS_INSTANCE" />
              <property name="identifier" value="spring-rm" />
              <property name="runtimeEnvironment" ref="runtimeEnvironment" />
          <bean name="processService" class="expertus.workflowengine.flowworker.bpm.ProcessServiceImpl" scope="prototype">
              <property name="runtimeManager" ref="runtimeManager" />
              <property name="workItemRegister" ref="processWorkItemRegister" />