Creating a loop / modelling a service


#1

Hello!

I’m trying to model a service that continuously (in a loop) polls a mailbox and works with the received mails. The process has no user interaction and only consists of service tasks.

Something like the pizza example of bpm-mail:


All my tasks in the workflow are service tasks and I want to automatically start the process over again after a run is finished.

This is my current approach:

My model is indeed working, but I suspect this isn’t the right approach.
Maybe it is a better idea to start a new process instance with a service task at the end of currently running task and create a loop that way?

Please show me the right way to design such a “service” (loop) process.


#2

Hi @tobof,

starting a new instance for every run definetly seems like the better idea.
For starting process-instances in specific intervals you can have a look at the timer start event. You could change your blank start event to a timer start event. There you can define a rule, in which intervals you want your instances to start.

The example from the documentation page is like this:

R4/2016-03-11T12:13/PT5M

This example will start 4 instances, in 5 minute intervals, starting on 11th of March 2016, at 12:13

So for the process of your current approach set the timer as the start event rather than at the end.

Hope this helps

Regards
Michael


#3

Hi @tobof,

have a look at this (quite old) example: https://github.com/camunda-consulting/code/tree/master/one-time-examples/counterparty-onboarding#complete-task-by-email

Hope this helps, Ingo


#4

Another option without explicitly modelling / polling: https://github.com/camunda/camunda-bpm-mail/tree/master/examples/print-service#using-the-mailnotificationservice


#5

Wow amazing, thank you!

I’ve followed @Philipp_Ossler hint and it works like a charm so far!