Uploaded image for project: 'Service Packs and Hot Fixes'
  1. Service Packs and Hot Fixes
  2. MNT-19562

APS tasks are not created in the database until on create event task listener is complete


    • Type: Service Pack Request
    • Status: Closed
    • Resolution: Won't Fix
    • Affects Version/s: Alfresco Process Services 1.8.1
    • Fix Version/s: None
    • Component/s: APS Engine, APS Tasks
    • Labels:


      When using a task with a Task Listener having an on create event, this delays the creation of the task in the ACT_RU_TASK and ACT_HI_TASKINST tables until the Task Listener completed.

      It is also possible within a Task Listener using the create event to get the task ID before it is actually created in the database. That is done using the following code:


      Customer Use Case
      The customer is using a custom class for a Task Listener on the create event. This custom class uses the delegateTask.getId() call, which returns the Task ID to a custom application (which their users connect to). That task ID is then used in a GET taskDetails REST API call (GET runtime/tasks/

      {taskId}) to populate the custom application with details of the task.

      Customer Impact
      In some scenarios, the GET runtime/tasks/{taskId}

      call is returning a 403 because the create event Task Listener is still running and the task itself has not yet been created in the database tables.

      Steps to reproduce
      Attached to the Jira is an app containing a workflow with a task and a create event task listener. Also attached to the Jira is a custom jar which gets the task ID and then simulates delay in completing the task listener by putting the thread to sleep for 30 seconds. Below is the code in the jar:

      package com.cody.test;
      import org.activiti.engine.delegate.DelegateTask;
      import org.activiti.engine.delegate.TaskListener;
      public class tlGetId implements TaskListener{
      	private static final long serialVersionUID = 1L;
          public void notify(DelegateTask delegateTask){
              System.out.println("#@#@taskID: "+delegateTask.getId());
              try {
      		} catch (InterruptedException e) {
      			// TODO Auto-generated catch block
      1. Upload the attached jar ATL.jar to activiti-app/WEB-INF/lib and start/restart the APS deployment
      2. Deploy and publish the attached app "tldelay.zip"
      3. From the published app start a process. Note in the APS console log, that the taskID is printed out but that the task has not yet been created in the database.
      4. In between 30 seconds (task listener programatic delay) after the process was started perform a REST call for GET runtime/tasks/ {taskId}

        using the task ID printed in the APS console log

      Expected Behavior
      The task creation in the database should not be delayed until the create event Task Listener is complete.

      Actual Behavior
      A 403 status is returned by the REST API call because the task listener did not complete yet and the task is not yet created in the database.
      However, it is possible to still get the task ID to be used in REST calls before the task even 'exists' in the database.


        1. ATL.jar
          1 kB
        2. tldelay.zip
          5 kB




              • Assignee:
                closedissues Closed Issues
                ccollins Cody Collins
              • Votes:
                0 Vote for this issue
                10 Start watching this issue


                • Created:

                  Structure Helper Panel