Information Technology Reference
In-Depth Information
Notice that the handler will only return each work item once. After that, all invocations of
the getItem method will return null until executeWorkItem is called again by the
process engine.
Have these implementations of WorkItemHandler registered in the session when we
execute a process composed of a call that is firstly identified by task1 and secondly by
task2 ; the execution will stop in the second task and wait for signals to carry on:
ProcessInstance pI =
ksession.startProcess("myExternalInteractionsProcess");
Assert.assetEquals(ProcessInstance.STATE_ACTIVE,
pI.getState());
Assert.assertEquals(1, handler1.getInvocationCount());
WorkItem item = handler2.getItem();
Assert.assertNotNull(item);
Now that we have the reference to the work item, we can use it to tell the session to carry
on with the process's execution:
Ksession.getWorkItemManager().completeWorkItem(item.getId(),
null);
We will cover a lot more about using work item handlers later on in this topic. However,
one of the provided WorkItem handlers has one particular importance: the external sys-
tem it communicates with allows you to interact with human beings. It is registered in the
exposed manager with the key Human Task . We will fully cover the configuration of
this handler in Chapter 7 , Defining Your Environment with the Runtime Manager , along
with the runtime manager in detail. Let's first discuss the system behind it and its compon-
ents.
Search WWH ::




Custom Search