-1

I am using org.activiti:spring-boot-starter-basic:5.17.0 and I am not able to persist the tasks meaning that the business process I defined runs perfectly but all the ACT_RU_* tables are always empty.

Should I explicitly switch on persistence? I have not found anything about it in the documentation (https://www.activiti.org/userguide/).

UPDATE

I have added a userTask but nothing has changed:

<definitions id="Definition"
             targetNamespace="http://www.jboss.org/drools"
             typeLanguage="http://www.java.com/javaTypes"
             expressionLanguage="http://www.mvel.org/2.0"
             xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"
             xmlns:g="http://www.jboss.org/drools/flow/gpd"
             xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI"
             xmlns:dc="http://www.omg.org/spec/DD/20100524/DC"
             xmlns:di="http://www.omg.org/spec/DD/20100524/DI"
             xmlns:tns="http://www.jboss.org/drools">

    <itemDefinition id="_personItem" structureRef="org.jbpm.examples.quickstarts.Person"/>

    <process processType="Private" isExecutable="true" id="test"
             name="Sample Process" tns:packageName="defaultPackage">

        <startEvent id="_1" name="StartProcess"/>

        <scriptTask id="_2" name="Script">
            <script>System.out.println("Hello Ivan");</script>
        </scriptTask>

        <userTask id="_3" name="User Task" >
            <ioSpecification>
                <inputSet>
                </inputSet>
                <outputSet>
                </outputSet>
            </ioSpecification>
        </userTask>

        <endEvent id="_4" name="End">
            <terminateEventDefinition/>
        </endEvent>

        <sequenceFlow id="_1-_2" sourceRef="_1" targetRef="_2"/>
        <sequenceFlow id="_2-_3" sourceRef="_2" targetRef="_3"/>
        <sequenceFlow id="_3-_4" sourceRef="_3" targetRef="_4"/>

    </process>


</definitions>

Thx

Iván
  • 31
  • 1
  • 6

1 Answers1

0

Have you configured the database correctly? You might be running the engine with an in memory databse such as H2

salaboy
  • 4,123
  • 1
  • 14
  • 15
  • I am using MySQL and the tables are created correctly in the database so I think the DB setup is correct. – Iván Jul 16 '18 at 06:17
  • I created a start node, two script nodes and an end node. They reside in a linear chain. The process runs correctly. Each nodes logs a message and I can see the logs. I suppose after each state change (e.g. jumping from one script task to the other) there should be some records in the DB. But there is no. – Iván Jul 16 '18 at 06:20
  • You need to enable history to record something, becuase that process runs without the need of persistance, so it start and ends in memory. Add a userTask and you will see the difference – salaboy Jul 16 '18 at 06:50
  • can you share the configurations? are you using doing it like here -> https://www.activiti.org/userguide/#jpaconfiguration – salaboy Jul 16 '18 at 10:51
  • Should I configure these things? I thought is was only needed if I would like to use my own domain objects. Shouldn't persistency work out of the box? – Iván Jul 16 '18 at 11:07
  • OK. Sorry I was wrong. The persistence works with the added userTask. But should not other type of tasks be persisted too? I mean scriptTask tasks for instance? What happens if there is a crash and the app restarts? Is not the state of the state machine persisted? – Iván Jul 16 '18 at 11:22
  • Or is it what the history feature does? – Iván Jul 16 '18 at 11:25
  • You need to read more about how a process engine works. Script tasks as not transactional, so only the history will record them when they are executed. History will record everything that happened in the process since started until it hits a safe point, in your case the user task – salaboy Jul 16 '18 at 11:38
  • OK. So if I understand well then not all the tasks have persistent state just some of them like userTask or receiveTask. These seem to be the async ones where we have to wait for a user interaction or message to receive. – Iván Jul 16 '18 at 15:07
  • You are getting it wrong.. please read the docs -> https://www.activiti.org/userguide/#bpmnConcurrencyAndTransactions – salaboy Jul 16 '18 at 15:21
  • OK. Thx for your help – Iván Jul 17 '18 at 06:59