Message Start Event

Hi Community,

I hope this is an easy question to answer:
I am trying to achieve and model which would allow in a one process instance with a one businessKey to start multiple times the same user task (multiple tokens for a one user task).
I am not sure how to model such thing as intermediate message event would only start if token is present, the same is applicable for the Receive Task , event subprocess stops other tasks to be for execution.

I am not sure maybe call activity can solve something like this?

Thank you

Hi Michal,

Perhaps a multi-instance activity would work for you?

1 Like

Thank you, almost there, now I need to start the multi-instance activity via REST API whenever needed (not a new process instance).

many thanks


this could be the solution but it doesn’t seem right

M

Can you explain your use case / story you are trying to build.

Hi,

the case is that there is not definite number of occasions which might be triggered as a user task, so for this case multi-instance activity seems to be the right solution,at the same time I do expect to have these indefinite number of tasks under one businessKey, to explain more these tasks are generated by external REST call, fortunately, user should know when task is the last one and at the same time user knows that there will not come any other task for the multi-instance activity.
Thus my assumption is that a message listener should be listening constantly till user decides that received task is the last one.

Thus in order to cancel message listner (or receive task listner) I have come to only one solution and that is to cancel the listner programmatically
e.g. something like this for completion but I would change it to cancel the listner
processEngine.getTaskService().createTaskQuery().processInstanceBusinessKey(execution.getProcessBusinessKey()).taskDefinitionKey(“aTASK”).singleResult();
processEngine.getTaskService().complete(…);

I am not aware of any other solution how to solve something like this, I mean without any programmatic solution or just purely by BPMN.

// OK :smiley: just got an idea to put check box for a last task to a form… sorry for taking your time

thank you.

@Michal_S

Can you explain the bpmn story / use case you are trying to build.

Hi,
Your use case could be a candidate for CMMN…Alternately, this [1] snippet may give you some inspiration…

regards

Rob

[1] https://github.com/camunda-consulting/code/tree/master/snippets/bpmn-adhoc-task

I believe the below picture solves the problem.and explains a lot

@Michal_S so your use case is:

  1. Someone starts the process
  2. The process calls a system through REST to get a list of tasks to complete
  3. For each task received, a User Task is generated.
  4. A user in the User Task can check a box that says “don’t listen anymore”, which will tel the process to stop creating tasks.

is this correct? aspects missing?

in general you are right
the picture I have posted is just portion of a bigger process.

basically

  1. token comes to a listner, once an external task finishes its job it tells listener via REST that the job is finished so
  2. user receives a task, users know whether to expect more tasks to come or the task received is the last one
    2a. user decides to listen for another tasks ( 1 is already listening for any potential incoming tasks)
    2b user decides to not listen anymore (listener receives a message which leads to EndEvent)
  3. end

take a look at those two scenarios. I think #2 is better. Also for S1, you will have to test to see how a Cycle timer functions within a sub-process and how to kill it using a Terminate (assuming it’s possible) – the docs dont indicate the behaviour. If you go with S1, please share how the timer behaves, would be good to update the docs.

also @Michal_S take a look at: Pattern Feedback: Timer Cycle Checking of external systems State/Status. It is a similar problem and outlines some of the different conditions and scenarios.

1 Like