Hi,
I would like to model a task to let users validate the continuation of a process:
- when the process instance reaches this task, an email is sent to a user.
- the email offers 2 clickable links: one for continuing the process execution, one to stop it
My application uses a Node server, and I believe there could be 2 approaches to implement this:
-
External Task: when launched by Camunda on my server, I would send the email to the user. Once one of the links is clicked, I set a “continuation” boolean variable, and complete the external task (and then a subsequent activity in the process would check this “continuation” variable to either stop or continue the process). However, is it an issue if an external task lasts several days (until a human being clicks the links)? I guess I should extend the task duration from time to time? But I also think Camunda “retries” an external task until it is completed, so would there be a risk that several emails are sent for the same task, due to these retries?
-
User Task: this seems to be a more standard BPMN/Camunda approach, but it is not clear to me:
- from my Node server, how can I get notified that the User Task has been created, so that I send the email at this point
- how should I manage the Camunda users and the assignment to the User Task? I already have a table of users in my server, but I am not too enthusiastic to have it replicated in the Camunda world (so far, I don’t have any Camunda users, and I am fine with it to handle the other processes)
Can you please let me know your thoughts about the best approach (and potentially other better options)?
Many thanks!
As I see no answer, which is unusual on this so-great forum, I wonder if my question was clear. Please feel free to let me know if it is not! Thank you 
Hi @bfredo123,
sometimes people are busy with other tasks…
I would go for the first approach and use a process model like this:
Use fire and forget the mail and wait in a reveice task. The link that the user clicks needs to translated into this rest call: Correlate a Message | docs.camunda.org
Hope this helps, Ingo
2 Likes
Thank you so much Ingo! Quite helpful.
However, if I want to simplify the process with only 1 activity instead of 2 (send + receive), to make modelling easier for end users, could I stick to the External Task, despite the potential very long time required to click the email?
Thank you again
Hi @bfredo123,
theoretical your proposal works as well, you have to deal with the long locking time by yourself. And you need the external task id to complete the task once the link is clicked.
Hope this helps, Ingo
1 Like
Thanks again Ingo. Yes, I would send the task Id somehow encrypted as a URL param.
I will investigate how to handle the timeout stuff, don’t know yet how to deal with this, but will check the doc.
@bfredo123,
We’re going to try the following (and if you’re interested I can assist with some of the details):
- We are building the Run distribution into a container with our custom code using it through REST API
- We built a Java listener to add to the Run Distribution that reacts to all User Tasks being started in all processes.
- We have a utility process that has a single External Task and it’s topic is set by a process variable.
So the listener will start the utility process passing in the process instance ID, the Task ID, and a specific topic name (“TaskStart”). Our custom code (your Node app) polls for external tasks and for all “TaskStart” topics, we pull the variables (the process ID and task ID), store them and complete the external utility task right away. We then use the IDs to then complete the user task when we want to (in a user interface in our case).
This way, the business BPMN file is clean, the Camunda system is decoupled from the application, there is no extra development by individual application teams to get the user task started event (meaning no custom java in Camunda).