I learned that the service task can be defined in a configuration file (see the following example), and added into the drools.rulebase.conf file (e.g., drools.workDefinitions = WorkDefinitions.conf abc.conf xyz.conf). It is obivous so far. To register a workitem handler for a service task, we use the following code:
ksession.getWorkItemManager().registerWorkItemHandler("Notification", new NotificationWorkItemHandler());
Is there any way to register a workitem handler for a service task declaratively (e.g., using the configuration file)? Here is the reason why I ask this question. When a BPMN2 designer added a new service task and used it in a process flow, I don't want the user needs to change Java code for its registration.
Example:
[
"name" : "Notification",
"parameters" : [
"Message" : new StringDataType(),
"From" : new StringDataType(),
"To" : new StringDataType(),
"Priority" : new StringDataType(),
],
"results" : [
"Result" : new StringDataType()
]
"displayName" : "Notification",
"icon" : "icons/notification.gif"
]
Can we define a workitem handler here? Or, any other declarative way? So, the workitem handler can be automatically bound to the Notification Service Task without changing code.
Thanks,
bwj