Sending an email after user task is created
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-20-2015 01:39 PM
We have a scenario where when a user task is created, a TaskListener is fired (on create) which will create a temporary login for a user and then email them the login details along with the task ID.
We'd like to use a Mail Task to handle the email sending as the content can then be customised in the BPM, so we came up with the following pattern in the BPM:
The idea is that once the task listener has finished it's work, it will send the message that the catch event is listening for and the email will be sent.
However, when we query for the execution for the message catch event, no results are returned:
I'm assuming that activiti is processing the branch from the parallel gateway to the user task first, so at this point the message catch event has not been created. Is there any way around this?
I've created a small unit tests which demonstrates the scenario:
https://drive.google.com/file/d/0Bz97E7VNAsowalBLOExFZmhlQms/view?usp=sharing
Thanks.
We'd like to use a Mail Task to handle the email sending as the content can then be customised in the BPM, so we came up with the following pattern in the BPM:
Start —> Parallel Gateway —> User Task | |—-> Message Intermediate Catch Event —> Mail Task
The idea is that once the task listener has finished it's work, it will send the message that the catch event is listening for and the email will be sent.
However, when we query for the execution for the message catch event, no results are returned:
List<Execution> executions = runtimeService.createExecutionQuery() .messageEventSubscriptionName("LOGIN_CREATED") .processInstanceId(delegateTask.getProcessInstanceId()).list(); if (executions != null && !executions.isEmpty()) { for (Execution e : executions) { runtimeService.messageEventReceived("LOGIN_CREATED", e.getId()); } }
I'm assuming that activiti is processing the branch from the parallel gateway to the user task first, so at this point the message catch event has not been created. Is there any way around this?
I've created a small unit tests which demonstrates the scenario:
https://drive.google.com/file/d/0Bz97E7VNAsowalBLOExFZmhlQms/view?usp=sharing
Thanks.
Labels:
- Labels:
-
Archive
5 REPLIES 5
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-20-2015 06:34 PM
If I understood well your problem, another solution could be to create a custom behaviour for your user task.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-21-2015 03:25 AM
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-21-2015 05:53 AM
Vasile - Thanks, will take a look into that as well.
Martin - Thanks very much for the reply. Could you check your file though please as it only seems to contain the folder and no source files.
** Update **
Actually, I've got it working by ticking the "Async" check box on the user task and enabling the async executer in the activiti config file.
Thanks for your help.
Martin - Thanks very much for the reply. Could you check your file though please as it only seems to contain the folder and no source files.
** Update **
Actually, I've got it working by ticking the "Async" check box on the user task and enabling the async executer in the activiti config file.
Thanks for your help.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-21-2015 11:54 PM

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-11-2018 03:54 PM
thank
