4 Replies Latest reply on Jul 13, 2015 1:25 AM by swiderski.maciej

    Tasks of completed instances are not removed

    jimmy001

      Hi,

       

      this morning I realized, that entries in the table "task" are no longer removed, if their process instance is completed. So far I couldn't find the class

      responsible for deleting the tasks of completed process instances. The completed process instance IS removed.

       

      The following classes are involved in the task completion, but they don't seem to remove tasks of completed instances:

           -     JPAProcessInstanceManager (I thought this would be the right place to look)

           -     JPATaskLifeCycleEventListener

         

      Who knows where (which class) I can find the lines, which remove the tasks of completed process instances?

      Thx for your help.

        • 1. Re: Tasks of completed instances are not removed
          jimmy001

          A short update:

          I found a class "TaskCleanUpProcessEventListener" and tried to register it in the EnviromentProducer by calling InjectableRegisterableItemsFactory.addProcessListener .

          But it is never called. Next I tried to register it in a subclass of "DeploymentServiceCDIImpl" by overriding "getRegisterableItemsFactory". Never called.

          • 2. Re: Tasks of completed instances are not removed
            swiderski.maciej

            that's the class responsible for removing it.

             

            What is your environment you run jBPM? Is it workbench? Custom app? What version of jBPM do you use?

             

            In general you have several options:

            - use CDI to provide listeners to be registered

            - use deployment descriptor to define listeners to be registered

            - manually register listeners by extending some implementations

             

            all depends on your use of jBPM

             

            HTH

            • 3. Re: Tasks of completed instances are not removed
              jimmy001

              Hi,

               

              I am using 6.3.snapshot and CDI Services embedded in my application. I would have exepected, that the following would work, since I can successfully register a task listener:

               

              /** Initializes runtime enviroment and manager for injection */
                  @PostConstruct
                  public void init() {                        
                      LOG.debug("Init Enviroment");        
                      factory.addTaskListener(MyTaskEventListener.class);        
                      factory.addProcessListener(TaskCleanUpProcessEventListener.class);
                      TaskModelProvider.setTaskModelProviderService(new MyTaskModelProviderService());
                      ProcessInstanceFactoryRegistry.INSTANCE.register( RuleFlowProcess.class,
                               new MyProcessInstanceFactory() );        
                  }
              

               

              But the processListener instance is never created.

              I am deploying the process by using DeploymentServiceCDIImpl, if this info is of any relevance.

              • 4. Re: Tasks of completed instances are not removed
                swiderski.maciej

                this won't work as TaskCleanupProcessEventListener requires task service to be able to find tasks by process instance id. Since you're using CDI I would recommend to use producer for it similar to what workbench is using.

                 

                HTH