Hi all,
Finally I found a way to solve my problem with my architecture.
Steps:
- I create in GUVNOR a new WorkItemDefinition in the package where my process is defined. Then the "Service Tasks" Tab is available in the Process Designer. (I could not set an image to the Service Task due some error to find it)
- I set in the designer the Service Task where I need it.
- In my Web Application I create a class that handles the Service Task and should implements org.drools.runtime.process.WorkItemHandler
- In the new class define the action in the executeWorkItem method. To complete the task from here this code is needed:
public void executeWorkItem(WorkItem workItem, WorkItemManager workManager) {
System.out.println("+++++++++++++ in the SubviewRevisionValidatorHandler ++++++++++++++++");
You can define a WebService client as in my case or the logic that you need
workManager.completeWorkItem(workItem.getId(), param);
}
- In my Web Application (that start the process) I set this lines before start a process where the first param is the name that you provide in Guvnor to the service and the second param is the new class in you App:
ksession.getWorkItemManager().registerWorkItemHandler("ServiceTaskName", new ServiceTaskItemHandler());