cancel
Showing results for 
Search instead for 
Did you mean: 

Task completion reminder

matesu
Champ in-the-making
Champ in-the-making
Hello,

Let me describe what I would like to archive. My goal is to make some kind of email notification about changes in the process. After completion of each task I would mail to creator and the assignee of next task.

Can I add task listener thought designer? or it should be done by editing xml? I use activiti in stand alone mode - is that mean I will have to put java logic with sending mail on activiti server? In general I would like to compose some kind of global task listener to not implement this in each process.

Is something like this possible to do without changes in activiti source?


Thanks in advance,
Mat
4 REPLIES 4

michael_thompso
Champ in-the-making
Champ in-the-making
this could be done by xml but for that you have to hire developer if you dont know how to do this.

jbarrez
Star Contributor
Star Contributor
That is possible with a global parse handler: http://activiti.org/userguide/index.html#advanced_parseHandlers

Add a handler for user tasks that adds the behaviour you want at runtime. Shouldn't need any XML changes for that.

matesu
Champ in-the-making
Champ in-the-making
Thanks jbarrez. I followed your instructions. Therefore I implemented:

<java>
public class MailDistribuctionParseHandler extends AbstractActivityBpmnParseHandler<UserTask> {

private static final Logger logger = LoggerFactory.getLogger(MailDistribuctionParseHandler.class);

@Override
protected void executeParse(BpmnParse bpmnParse, UserTask userTask) {
  ActivityImpl activity = findActivity(bpmnParse, userTask.getId());
  String assignee = userTask.getAssignee();
  String owner = userTask.getOwner();
 
  System.out.println("———————- " + assignee + " " + owner + " —————-");
  logger.info("———————- " + assignee + " " + owner + " —————-");
}
}
</java>

Then packed to jar, put in libs and registered as postBpmnParseHandlers. I created and instantiated a proccess. After using a REST API to finnish user task I did not notice anything in logs. Would this parser activate while I finnish task with REST API?


Thanks in advance,
Mat

trademak
Star Contributor
Star Contributor
Hi Mat,

The parse handler is executed when the process definition is deployed to the Activiti Engine.
So not when executing a task. You can add the task listener you need in this parse handler and that listener will be executed at runtime.

Best regards,