cancel
Showing results for 
Search instead for 
Did you mean: 

Runtime tables are not updated

amsel
Champ in-the-making
Champ in-the-making
Hi,

I'm using activiti with a postgresql database. The deployment of bpmn models works and I can see them in my database, but when I start a process, the act_ru_* tables aren't updated. And if I restart my program the processes aren't resumed. Can you tell me, what I'm doing wrong?

This is my activiti.cfg.xml-file:


<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.xsd
        http://www.springframework.org/schema/context">

    <bean id="processEngineConfiguration" class="org.activiti.engine.impl.cfg.StandaloneProcessEngineConfiguration">

        <property name="jdbcUrl" value="jdbc:postgresql://…" />
        <property name="jdbcDriver" value="org.postgresql.Driver" />
        <property name="jdbcUsername" value="…" />
        <property name="jdbcPassword" value="…" />

        <property name="jobExecutorActivate" value="false" />
        <property name="asyncExecutorEnabled" value="true" />
        <property name="asyncExecutorActivate" value="true" />
      
    </bean>
 
</beans>


Thanks in advance for your help!

Amsel
5 REPLIES 5

vasile_dirla
Star Contributor
Star Contributor
Hi Amsel,
Do you have any errors in the log file?
What's the Activiti version you are using ?
if you have a junit test which have such a behaviour would be great to attach it here as a zip.

amsel
Champ in-the-making
Champ in-the-making
I wrote a junit test with the template now and it turned out that just the service tasks aren't stored in the runtime tables. Is this meant to be that way?

I'm currently only using service tasks and I would like them to get restarted if they haven't finished and my program is interrupted and later restarted.

I can also upload the test project if you still need it. I'm using the Activiti version 5.19.0.1 and there are no errors in the log file.

martin_grofcik
Confirmed Champ
Confirmed Champ
Hi Amsel,

jUnit test would help.

Regards
Martin

amsel
Champ in-the-making
Champ in-the-making
I attached the zip file. I renamed it to *.txt, as I was only allowed to upload *.txt files.

The first assertion for the user task passes and the second assertion for the service task fails.

martin_grofcik
Confirmed Champ
Confirmed Champ
Hi Amsel,

Your jUnit test makes things much easier to understand and solve.
The problem is that information about finished processes is not stored in the runtime tables. You can get this information from the history:


    @Test
    @Deployment(resources = {"org/activiti/test/my-process.bpmn20.xml", "org/activiti/test/my-process-service-task.bpmn20.xml"})
    public void test() {
        ProcessEngines.init();
        final ProcessEngine processEngine = ProcessEngineConfiguration
                .createProcessEngineConfigurationFromResourceDefault()
                .setHistory(HistoryLevel.FULL.getKey())
                .buildProcessEngine();

        long historicProcessInstancesCountBeforeServiceTask = activitiRule.getHistoryService().createHistoricProcessInstanceQuery().count();
        new Thread(new Runnable() {
            public void run() {
                processEngine.getRuntimeService().startProcessInstanceByKey("my-process-service-task");

            }
        }).start();
        try {
            Thread.sleep(20000);
        } catch (InterruptedException ex) {
            Logger.getLogger(MyUnitTest.class.getName()).log(Level.SEVERE, null, ex);
        }

        long historicProcessInstancesCountAfterServiceTask = activitiRule.getHistoryService().createHistoricProcessInstanceQuery().count();
        assertEquals(historicProcessInstancesCountBeforeServiceTask + 1, historicProcessInstancesCountAfterServiceTask);
    }

Further reading
http://activiti.org/userguide/index.html#historyConfig
activiti jUnit tests.

Another issue is that Java delegate takes sleeps for 10000 - is not finished before the assertion.

public class TestServiceTaskWait implements JavaDelegate {

    @Override
    public void execute(DelegateExecution execution) throws Exception {
        Thread.sleep(10000000);
    }

}

It means that transaction is not committed before process has finished
http://activiti.org/userguide/index.html#bpmnConcurrencyAndTransactions

Regards
Martin