JBoss Community

Re: registerWorkItemHandler workItemName

created by Esteban Aliverti in jBPM - View the full discussion

It seems that if you want to usa a  then you need to define the interface of your service in the process definition. The interface defines an operation and then you can use that operation in your  node.  Here is an example: https://github.com/droolsjbpm/jbpm/blob/master/jbpm-bpmn2/src/test/resources/BPMN2-ServiceProcess.bpmn2  This is a generic way to invoke services, but I'm not sure if it is the best. If you use a  then you need to register a generic "ServiceTaskHandler" to it. Because it is generic, you can attach the same handler to all your  nodes.  The ServiceTaskHandler class is a WorkItemHandler that will take the parameters defined in the  your  references, instantiate a new class (the one defined in 's 'name' attribute) using reflection, and finally it will try to invoke the method defined by the  element. For simple scenarios, this could be enough, but for more complex situations, I think a plain  node with a custom WorkItemHandler is much better.  Here is the implementation of ServiceTaskHandler: https://github.com/droolsjbpm/jbpm/blob/master/jbpm-bpmn2/src/main/java/org/jbpm/bpmn2/handler/ServiceTaskHandler.java  Because  node has this 'generic' behavior, I'm not sure if you can attach different Handlers to different node instances. Again, I think a  node is much better. 

Reply to this message by going to Community

Start a new discussion in jBPM at Community