5 Replies Latest reply on Apr 25, 2011 7:46 AM by salaboy21

    Difference between WorkItemHandler and TaskHandler

    heathcliff

      Hi,

       

      There are classes that implement/extend WorkItemHandler or TaskHandler and are all called *TaskHandler... What is the difference in use and work of WorkItemHandler and TaskHandler.

      UserTaksHandler -> TaskHandler

      WSHumanTaskHandler -> WorkItemHandler

       

      Thx to all.

        • 1. Difference between WorkItemHandler and TaskHandler
          salaboy21

          Hi, the difference is that *TaskHandlers are specific implementations of WorkItemHandlers to handle human tasks in different scenarios.

          WorkItemHandler can be used to interact with any external entity, the taskHandlers are specific to human actors.

          If you need to interact with an external service you can implement your workitemhandler specific for that service.

          Greetings.

          • 2. Re: Difference between WorkItemHandler and TaskHandler
            heathcliff

            Hi!

             

            But when I see TaskHandler implementation they look like classes for handling node elements of the diagram. It looks like internal class of the engine not something I can extend nad register as handler.

             

            ie WSHumanTaskHandler uses WorkItemHandler and I can register it in WorkItemManager to be used. I can't see any example of implementing TaskHandler for use with some user taks scenerio.

            • 3. Re: Difference between WorkItemHandler and TaskHandler
              salaboy21

              Totally.. you should be using those internal classes. The one called task handler is the one incharge of parsing the xml tag, as far as I remember.

              The other ones like CommandBasedWSHTWorkItemHandler, where HT means Human Task is in charge of handling the Human interactions from the session perspective. This Handler will be in charge of creating new task on the task server component when a processes hits one User Task node.

              Greetings.

              • 4. Re: Difference between WorkItemHandler and TaskHandler
                heathcliff

                I think You are using missleading class names.

                There is class TaskHandler that is responsible for parsing node xml.

                There is class WorkItemHandler that is used for executing actions that developer can assign to specific types of nodes. This is if I understand right. Or mabe only for human tasks?

                 

                And now there are many classes that extend WorkItemHandler but are named *TaskHandler even if they have nothing to do with TaskHandler class. Its hard to read developers intentions when reading API and the source code.

                • 5. Re: Difference between WorkItemHandler and TaskHandler
                  salaboy21

                  Yes you are right, some of the names are clashing there. I will fire a Jira issue to fix them as appropriate.

                  One way to get things clear is to say that all the classes inside the org.jbpm.bpmn2.xml package are internal to the parser and should not be used when you are developing a process, because they are internal to the framework.

                  For domain specific activities you should use WorkItemHandlers that are the generic way of interacting with external entities from the process perspective. If the activity is done by a Human or a System doesn't care for the engine. We provide some HumanTask related work Item handlers (that's where the name clashes) but using any IDE you can take a look at the source and realize that they all extends WorkItemHandler, as you notice.

                   

                  Greetings.