Uploaded image for project: 'jBPM'
  1. jBPM
  2. JBPM-4359

Custom TaskLifeCycleEventListener are not called on Task Events

XMLWordPrintable

      I have created two custom producers, one for ProcessEventListener and the other for TaskLifeCycleEventListener. Also I am using InjectableRegisterableItemsFactory. jBPM calls the callback methods of the ProcessEventListener during various phases of the process lifecycle but the callback methods of TaskLifeCycleEventListener are not called during various phases of the task.

      The reason being what I observed in InjectableRegisterableItemsFactory, the get getProcessEventListeners iterates over all the injected process event listener producers but getTaskListeners does not take into consideration of the injected taskListenerProducer hence the injected beans of task life cycle never make it to the defaultListeners list. Also the name of the method should be changed from getTaskListeners to getTaskEventListeners to be in sync with other getter methods for listeners.

      I have attached my java files.

      @Override
      public List<ProcessEventListener> getProcessEventListeners(RuntimeEngine runtime) {

      List<ProcessEventListener> defaultListeners = new ArrayList<ProcessEventListener>();
      if(auditlogger != null)

      { defaultListeners.add(auditlogger); }

      else if (getAuditBuilder() != null) {
      AbstractAuditLogger aLogger = getAuditLoggerInstance(runtime);
      if (aLogger != null)

      { defaultListeners.add(aLogger); }

      }
      try {
      for (EventListenerProducer<ProcessEventListener> producer : processListenerProducer)

      { defaultListeners.addAll(producer.getEventListeners(((RuntimeEngineImpl)runtime).getManager().getIdentifier(), getParametersMap(runtime))); }

      } catch (Exception e) {
      logger.warn("Exception while evaluating ProcessEventListener producers {}", e.getMessage());
      }
      // add listeners from descriptor
      defaultListeners.addAll(getEventListenerFromDescriptor(runtime, ProcessEventListener.class));
      return defaultListeners;
      }

      @Override
      public List<TaskLifeCycleEventListener> getTaskListeners()

      { List<TaskLifeCycleEventListener> defaultListeners = new ArrayList<TaskLifeCycleEventListener>(); // add listeners from descriptor defaultListeners.addAll(getTaskListenersFromDescriptor()); return defaultListeners; }

        1. CustomApplicationScopedProducer.java
          4 kB
          Anindya Saha
        2. CustomApplicationScopedProducer.java
          4 kB
          Anindya Saha
        3. CustomProcessEventListenerProducer.java
          0.9 kB
          Anindya Saha
        4. CustomTaskEventListenerProducer.java
          1.0 kB
          Anindya Saha
        5. CustomTaskEventListenerProducer.java
          1 kB
          Anindya Saha
        6. pom.xml
          6 kB
          Anindya Saha

              swiderski.maciej Maciej Swiderski (Inactive)
              anindyas79 Anindya Saha (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: