Information Technology Reference
In-Depth Information
the possibility to create new tasks; interact with them, one user at a time; complete them;
and so on. The next step in our configuration will be to connect it to the actual process
runtime.
Connecting to the KIE session
By now, we have a task service instance running against a database and a user data source.
We now need to connect it to the process runtime so that each process instance can create
tasks in the Human task component and the Human task component can notify the process
runtime when a Human task has been completed.
The connector, as we saw in Chapter 2 , BPM Systems' Structure , is based on the
WorkItemHandler interface, and for our particular case, it is going to be the
NonManagedLocalHTWorkItemHandler implementation, as shown in the follow-
ing code:
WorkItemHandler htHandler = new
NonManagedLocalHTWorkItemHandler(
ksession, taskService);
ksession.getWorkItemManager().registerWorkItemHandler(
"Human Task", htHandler);
Using the Human Task reserved key, we can register a work item handler specific to
handling User tasks. In this opportunity, the instance we selected is prepared to create a
new task every time a process instance enters a new task. At the same time, this handler
will register a listener on the task service to receive notification when the created task is
completed, skipped, or failed, in order to call the completeWorkItem method on the
work item manager.
The most interesting thing about the interaction between the process runtime and the task
service is that it minimizes the interaction with the process runtime. The more the systems
take care of notifying the process instance that it should continue, the less you have to do
it. You'll find out that the only interaction with the KIE session for the test available in
human-task-components-api is to start the process; all the subsequent activities
are handled directly through the task service. We request specific tasks available for a de-
veloper or a tester and complete them using the available methods:
List<TaskSummary> tasks = taskService.
getTasksAssignedAsPotentialOwner("john", "en-UK");
Search WWH ::




Custom Search