[jboss-user] [jBPM] - Re: registerWorkItemHandler workItemName

Esteban Aliverti do-not-reply at jboss.com
Mon Aug 22 02:24:39 EDT 2011


Esteban Aliverti [http://community.jboss.org/people/eaa] created the discussion

"Re: registerWorkItemHandler workItemName"

To view the discussion, visit: http://community.jboss.org/message/622080#622080

--------------------------------------------------------------
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 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 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
[http://community.jboss.org/message/622080#622080]

Start a new discussion in jBPM at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20110822/237849fa/attachment.html 


More information about the jboss-user mailing list