cancel
Showing results for 
Search instead for 
Did you mean: 

UserTask is looping all the time

chandanmb1
Champ on-the-rise
Champ on-the-rise
Hello,

I have added the TaskListener for the UserTask.
<userTask id="push" name="Push the Message to Queue">
      <extensionElements>
        <activiti:taskListener event="create" class="com.UserCreateListener"></activiti:taskListener>
        <activiti:taskListener event="complete" class="com.UserCompleteListener"></activiti:taskListener>
      </extensionElements>
    </userTask>

When i start the activiti process, it is calling UserCreateListener and i am completing it. It will move to UserCompleteListener.
In the UserCompleteListener, it is looping the method notify and process is not finishing it off.

<code>
           public void notify(DelegateTask delegateTask) {
      System.out.println("Completing the Task::::::::"+delegateTask.getId());
      
      DelegateExecution execution = delegateTask.getExecution();
      EngineServices engineServices = execution.getEngineServices();
      TaskService taskService = engineServices.getTaskService();
      
      taskService.claim(delegateTask.getId(), "Abhilash");
      taskService.complete(delegateTask.getId());
      
      System.out.println("Finished");
      
   }
<code>
2 REPLIES 2

jbarrez
Star Contributor
Star Contributor
You are completing it in the listener? Don't think that's going to work via the taskService.
What's the idea/use case for this?

chandanmb1
Champ on-the-rise
Champ on-the-rise
Yes. You are correct. My mistake Smiley Happy