cancel
Showing results for 
Search instead for 
Did you mean: 

How to close task within create task listener

penusila611621
Champ in-the-making
Champ in-the-making
I have a requirement to implement skip OR execute human activities in process flow. I have configured a task listener on create task event.
Should I am able to close this task with in lsitener itself using task object.

Basically  I am expecting features as below.

public class CommonTaskListener implements TaskListener{   
   private static final long serialVersionUID = 1L;
   
   @Override
   public void notify(DelegateTask task) {
   
                   if(based on some condition) tasl.close()///Is there any method like this.
                   else { run other business logic}   
       
   }
}

Anybody let me know if is there any feature avaiable to implement one of the critical business requirement.
3 REPLIES 3

martin_grofcik
Confirmed Champ
Confirmed Champ
Hi,

There are several options. I pick only two of them:

  • "Your" option - I used something similar for simulation purposes (another case could be debug and replay/playback). Task create event scheduled new event to complete the task in the event calendar (taskService.complete(taskId)).
  • More straight forward way is to describe such a case in process definition (e.g. exclusive gateway - do not create userTasks, which are not needed).
I would prefer option 2 in the most cases.

Regards
Martin

penusila611621
Champ in-the-making
Champ in-the-making
HI Martin,

Perfectly agree with you that option 2 is ideal way to implementing this requirement.  We have a process with 10 activities and these activities executes based on some business conditions means upfront we never know which one executes and which one not. So I have to keep a decision gateway to bypass the flow. Our customer does't want decision gateway's to be put in between all the activities. I am wondering why activiti has no property to skip/run the activiti. I can see this feature in most of the BPM suits.

jbarrez
Star Contributor
Star Contributor
> I am wondering why activiti has no property to skip/run the activiti. I can see this feature in most of the BPM suits.

We implement the BPMN 2.0 spec. The spec doesn't have this, thats the reason why we dont have it.