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

GenericCommandBasedWSHumanTaskHandler wrong HT server listener registration

    XMLWordPrintable

Details

    Description

      GenericCommandBasedWSHumanTaskHandler is registering a listener on HT server for without a proper filter (-1 as task id):

      private void registerTaskEventHandlers() {
              TaskEventKey key = new TaskEventKey(TaskCompletedEvent.class, -1);
              TaskCompletedHandler eventResponseHandler = new TaskCompletedHandler();
              client.registerForEvent(key, false, eventResponseHandler);
              key = new TaskEventKey(TaskFailedEvent.class, -1);
              client.registerForEvent(key, false, eventResponseHandler);
              key = new TaskEventKey(TaskSkippedEvent.class, -1);
              client.registerForEvent(key, false, eventResponseHandler);
      }
      

      This is correct because at the time the listener is registered we don't know yet the id of the task.
      The problem with this approach is that in a scenario with multiple sessions having human tasks, when a task is completed ALL the sessions are notified. The first listener in being notified will try to complete the task even if the task doesn't belong to the current session.
      A workaround could be to modify GetCompletedTaskResponseHandler.execute() to compare the sessionId associated to the task with the sessionId of the ksession in the handler. This solution, even if it works, doesn't scale well since all the sessions are still notified and each of the handlers will try to retrieve the task from HT Server generating an unnecessary network trafic traffic (if the HT server is not local).
      A better solution could be to send the sessionId when the handler gets notified. This way the handler could know whether it has to continue or not with the execution of a process before it gets the complete task from the server.

      Attachments

        Activity

          People

            swiderski.maciej Maciej Swiderski (Inactive)
            esteban.aliverti@gmail.com Esteban Aliverti (Inactive)
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: