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

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

    CHRISTIAN TASSIN Newbie

      Hi,

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

       

      Subject:

      • 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.

       

      Technologies:

      • 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.

       

      How:

      • 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"
                destroy-method="close">
              <property name="entityManagerFactory" ref="bpmEMF" />
              <property name="transactionManager" ref="jtaTransactionManager" />
              <property name="listeners">
                  <list>
                      <bean class="org.jbpm.services.task.audit.JPATaskLifeCycleEventListener">
                          <constructor-arg>
                              <value>true</value>
                          </constructor-arg>
                      </bean>
                  </list>
              </property>
          </bean>
          <bean id="customLogFactory" class="expertus.workflowengine.flowworker.utils.CustomLogFactory" />
      
          <bean id="process" factory-method="newClassPathResource"
                class="org.kie.internal.io.ResourceFactory">
              <constructor-arg>
                  <value>${process.model}</value>
              </constructor-arg>
          </bean>
      
          <bean id="runtimeEnvironment"
                class="org.kie.spring.factorybeans.RuntimeEnvironmentFactoryBean">
              <property name="type" value="DEFAULT" />
              <!--<property name="registerableItemsFactory" ref="customLogFactory" />-->
              <property name="entityManagerFactory" ref="bpmEMF" />
              <property name="transactionManager" ref="jtaTransactionManager" />
              <property name="assets">
                  <map>
                      <entry key-ref="process">
                          <util:constant static-field="org.kie.api.io.ResourceType.BPMN2" />
                      </entry>
                  </map>
              </property>
      
              <property name="taskService" ref="taskService" />
          </bean>
      
          <bean id="runtimeManager" class="org.kie.spring.factorybeans.RuntimeManagerFactoryBean"
                destroy-method="close">
              <property name="type" value="PER_PROCESS_INSTANCE" />
              <property name="identifier" value="spring-rm" />
              <property name="runtimeEnvironment" ref="runtimeEnvironment" />
          </bean>
      
          <bean name="processService" class="expertus.workflowengine.flowworker.bpm.ProcessServiceImpl" scope="prototype">
              <property name="runtimeManager" ref="runtimeManager" />
              <property name="workItemRegister" ref="processWorkItemRegister" />
          </bean>