[jboss-user] [jBPM] - Re: jBPM 5.1 in a real world web application

Krishna Pitla do-not-reply at jboss.com
Fri Jul 13 08:02:27 EDT 2012


Krishna Pitla [https://community.jboss.org/people/krishnapitla] created the discussion

"Re: jBPM 5.1 in a real world web application"

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

--------------------------------------------------------------
hi ashutosh,

try out this code kbuilder.add(ResourceFactory.+newClassPathResource+(
"simplerule.drl"), ResourceType.++DRL++); 

in your code where you try to start the process .

Sample code pasted below :

***package
**
* com.sample;






























***import
**
 org.drools.KnowledgeBase;
***import
**
 org.drools.builder.KnowledgeBuilder;
***import
**
 org.drools.builder.KnowledgeBuilderFactory;
***import
**
 org.drools.builder.ResourceType;
***import
**
 org.drools.io.ResourceFactory;
***import
**
 org.drools.runtime.StatefulKnowledgeSession;

/**
* This is a sample file to launch a process.
*/
***public
**
 **class** ProcessMain {


**public** **static** **final** **void** main(String[] args) **throws** Exception {

// load up the knowledge base

KnowledgeBase kbase = +readKnowledgeBase+();
StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();

// start a new process instance

ksession.startProcess(
"com.sample.bpmn.hello");ksession.insert(

**new** Account());ksession.fireAllRules();
}



**private** **static** KnowledgeBase readKnowledgeBase() **throws** Exception {KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.+newKnowledgeBuilder+();
kbuilder.add(ResourceFactory.+newClassPathResource+(

"simplerule.drl"), ResourceType.++DRL++);
kbuilder.add(ResourceFactory.+newClassPathResource+(

"sample.bpmn"), ResourceType.++BPMN2++);

**return** kbuilder.newKnowledgeBase();} }
*******


Hope this helps . Though i am still new to jbpm and drools. So if i have missed something then please pardon me.
--------------------------------------------------------------

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

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/20120713/20bee7ea/attachment.html 


More information about the jboss-user mailing list