1 Reply Latest reply on Jun 1, 2012 7:46 AM by Maciej Swiderski

    Task Service Issue

    Bhaskaran Venkataraman Newbie

      I am trying to understand the Human Task Service through an example. I found useful information regarding

      the communication between the Task Client and the Task Service in the User Guide.

       

      TaskClient client = new TaskClient(new MinaTaskClientConnector("client 1",

          new MinaTaskClientHandler(SystemEventListenerFactory.getSystemEventListener())));

      client.connect("127.0.0.1", 9123);


      // adding a task

      BlockingAddTaskResponseHandler addTaskResponseHandler = new BlockingAddTaskResponseHandler();

      Task task = ...;

      client.addTask( task, null, addTaskResponseHandler );

      long taskId = addTaskResponseHandler.getTaskId();

             

      // getting tasks for user "bobba"

      BlockingTaskSummaryResponseHandler taskSummaryResponseHandler =

          new BlockingTaskSummaryResponseHandler();

      client.getTasksAssignedAsPotentialOwner("bobba", "en-UK", taskSummaryResponseHandler);

      List<TaskSummary> tasks = taskSummaryResponseHandler.getResults();


      // starting a task

      BlockingTaskOperationResponseHandler responseHandler =

          new BlockingTaskOperationResponseHandler();

      client.start( taskId, "bobba", responseHandler );

      responseHandler.waitTillDone(1000);


      // completing a task

      responseHandler = new BlockingTaskOperationResponseHandler();

      client.complete( taskId, "bobba".getId(), null, responseHandler );

      responseHandler.waitTillDone(1000);

       

      But in the evaluation sample code there is only a specific type of HumanTaskHandler (HornetQ) registered listening on

      a particular port and then the process is started. I mean we have not instantiated any Task Client and we are not doing

      any manual processing of the human tasks. It is not clear what happens behind the scenes.

       

      If we have to use the task client and handle all the actions mentioned above how do we communicate with the

      JBPM Engine. After the process is started by the engine and when a human task is encountered how does it come to

      execute our code.

       

      If there is an example to illustrate the sequence it will help.

       

      Thanks for your help.

        • 1. Re: Task Service Issue
          Maciej Swiderski Master

          Human task handler will use task client and register to certain events (completed, failed, etc). So as soon as task is completed (or any other finishing operation) task server will trigger events to be sent to all known clients and this is how engine will be notified about various events that happened on ht server.

           

          HTH

          1 of 1 people found this helpful