[jboss-user] [jBPM] - Re: Register more than one WorkItemHandler

Sergey Kornilov do-not-reply at jboss.com
Tue Apr 30 11:31:39 EDT 2013


Sergey Kornilov [https://community.jboss.org/people/kornilovs] created the discussion

"Re: Register more than one WorkItemHandler"

To view the discussion, visit: https://community.jboss.org/message/810979#810979

--------------------------------------------------------------
I add new WorkItemHandler to WorkDefinitions and create process with it

[
    "name" : "CustomHandler",
    "parameters" : [
      "Message" : new StringDataType()
    ],
    "displayName" : "CustomHandler",
    "icon" : ""
  ]
 https://community.jboss.org/servlet/JiveServlet/showImage/2-810979-20693/for+answer3.png  https://community.jboss.org/servlet/JiveServlet/downloadImage/2-810979-20693/228-342/for+answer3.png 




create new class

import org.drools.process.instance.WorkItemHandler;

       class CustomWorkItemHandler implements WorkItemHandler{

            @Override
            public void executeWorkItem(WorkItem workItem, WorkItemManager manager) {
                // TODO Auto-generated method stub
                System.out.println("**************************** CustomWorkItemHandler executeWorkItem"+ workItem.getProcessInstanceId());
            }

            @Override
            public void abortWorkItem(WorkItem workItem, WorkItemManager manager) {
                // TODO Auto-generated method stub
                System.out.println("**************************** CustomWorkItemHandler abortWorkItem" + workItem.getProcessInstanceId());
            }
               
       }

register  WorkItemHandler

ksession.getWorkItemManager().registerWorkItemHandler("CustomHandler", new CustomWorkItemHandler());

run process and get result
19:00:18,103 INFO  [stdout] (http--0.0.0.0-8080-34) **************************** CustomWorkItemHandler executeWorkItem170

you have some error when register your custom email handler?
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/810979#810979]

Start a new discussion in jBPM at Community
[https://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/20130430/6c99378e/attachment.html 


More information about the jboss-user mailing list