[jboss-user] [jBPM] - Re: How to get WorkItemHandler results

Esteban Aliverti do-not-reply at jboss.com
Mon Feb 27 03:34:28 EST 2012


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

"Re: How to get WorkItemHandler results"

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

--------------------------------------------------------------
> The application I'm making makes the interaction with the user through the web designer. Therefore I'll need to run the process definition in a Servlet. As such I'm startin the process within the Servlet and the WorkItemHandler will be returning information to be sent to the user. As such isn't this the only way to do it? Because executeWorkItem is void I can't send it to the Servlet...right?
The WorkItemHanlder always returns information to the process. If you map the return of your Handler to a process variable, you can get the value of that variable right after you do session.startProcess() (assuming there is no intermediate wait-state before your Work Item). So, the process will start, it will exectue the WI Handler, the Handler will create the result and complete the WI (passing the result) the result will be map to a process variable (because you explicitly defined this mapping) and then, the process will continue until it reaches a wait-state or an End Event Node. At this point, the control will be returned to your servlet where you can read the pocess variable value.
There are possibly more than 100 other ways to do this same thing. Pass some listener to the WI Handler that will be invoked when the result is ready, use JMS to communicate the Handler and your code, etc. 

> My other one is the web app is running in jBoss and although there shoudln't e problems mixing jBpm and jBoss web I'm having some troubles. I get: 
> java.lang.ClassNotFoundException: org.drools.runtime.process.WorkItemHandler 
> When deploying the application. What can I do?
Which dependencies are you defining in your app? You should also include some of the drools dependencies:  

<dependency>
            <groupId>org.drools</groupId>
            <artifactId>knowledge-api</artifactId>
            <version>5.4.0-SNAPSHOT</version>
            <type>jar</type>
        </dependency>
        <dependency>
            <groupId>org.drools</groupId>
            <artifactId>drools-core</artifactId>
            <version>5.4.0-SNAPSHOT</version>
        </dependency>
        <dependency>
            <groupId>org.drools</groupId>
            <artifactId>drools-compiler</artifactId>
            <version>5.4.0-SNAPSHOT</version>
        </dependency>
        <dependency>
            <groupId>org.jbpm</groupId>
            <artifactId>jbpm-bpmn2</artifactId>
            <version>5.3.0-SNAPSHOT</version>
        </dependency>
        <dependency>
            <groupId>org.jbpm</groupId>
            <artifactId>jbpm-flow</artifactId>
            <version>5.3.0-SNAPSHOT</version>
        </dependency>
        <dependency>
            <groupId>org.jbpm</groupId>
            <artifactId>jbpm-flow-builder</artifactId>
            <version>5.3.0-SNAPSHOT</version>
        </dependency>

Best Regards,
--------------------------------------------------------------

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

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/20120227/29711dee/attachment.html 


More information about the jboss-user mailing list