Identify and get mail task from Service task

Showing results for 
Search instead for 
Did you mean: 
Member II

Identify and get mail task from Service task


I am a beginner in activiti. Using activiti6 standalone on tomcat 8.

I am trying to get mail task after creating deployment of bpmn file.

I have deployed the bpmn file.

After that iterating over FlowElements of the process. Here I am able to get all type of tasks.

But for mail tasks also I get "org.activiti.bpmn.model.ServiceTask" from element.

How can I identify "mail task" here?

Below is the code.

Deployment deployment = repositoryService.createDeployment() .addInputStream(resourceName, is) .deploy();

List<ProcessDefinition> processDefinitions = repositoryService.createProcessDefinitionQuery().deploymentId(deployment.getId()).list();

 for(ProcessDefinition procDef : processDefinitions){
             BpmnModel bpmnModel = repositoryService.getBpmnModel(procDef.getId());
             List<org.activiti.bpmn.model.Process> processes = bpmnModel.getProcesses();
             for (org.activiti.bpmn.model.Process p : processes) {
                 Collection<FlowElement> elements = p.getFlowElements();
                 for (FlowElement element : elements) {

                     if (element instanceof ServiceTask) {





Please give suggestions.