Okay so:
Your Model has a few minor issues; There is a error with the reminderSent section, where you have the Cancel Activity as part of the ServiceTask, and the servicetask does not have proper config.
If you are using a IDE, you should see these errors with the code-completion, as well as that model will throw a error when trying to deploy/execute the process in the engine.
- If i fix up the model with:
BpmnModelInstance model = Bpmn.createExecutableProcess('model')
.name("Reminder Demo")
.startEvent()
.userTask('readEmail')
.boundaryEvent()
.timerWithDuration("PT1H")
.cancelActivity(true)
.endEvent()
.moveToActivity('readEmail')
.boundaryEvent()
.timerWithCycle("R3/PT10M")
.cancelActivity(false)
.serviceTask()
.name('reminderSent')
.implementation('expression')
.camundaExpression('${1+1}')
.endEvent()
.moveToActivity('readEmail')
.endEvent()
.done()
return model
which is a fully deployable model, it outputs the following image:
(post visual adjustment)
Assuming “move on” means that the process will 'end; then yes after atleast ~1h (there is of course possible delay due to job executor picking up the job), from when the user task is created, the task will no longer be available; as per your PT1H.
and your non-interrupting timer is: R3/PT10M
, which would execute every 10 minutes for a max total of 3 times. (less if the user task is complete before that). So your logic appears correct.
Assuming you are not having a single task as your process, you might be looking for something like this:
BpmnModelInstance model = Bpmn.createExecutableProcess('model')
.name("Reminder Demo")
.startEvent()
.userTask('readEmail')
.boundaryEvent('killusertask')
.timerWithDuration("PT1H")
.cancelActivity(true)
.moveToActivity('readEmail')
.boundaryEvent()
.timerWithCycle("R3/PT10M")
.cancelActivity(false)
.serviceTask()
.name('reminderSent')
.implementation('expression')
.camundaExpression('${1+1}')
.endEvent()
.moveToActivity('readEmail')
.manualTask('manual1').name('do something')
.moveToNode('killusertask').connectTo('manual1')
//.moveToActivity('killusertask').connectTo('manual1') This does not work. Must use the moveToNode()
.manualTask('manual2').name('do something else')
.endEvent()
.done()
return model
edit: also take note about where the .modeToNode() line is in the code; It is after we have created the ‘do something’ task, as the API appears to move in order, thus you are unable to connect the timer to a task that does not exist yet in the flow, because you have not reached it in the fluent api
The moveToNode() has to be used because the connectTo() is part of the FlowNode system rather than the activity.
which will create (after visual cleanup):