[jboss-dev-forums] [jBPM Development] - Re: Creating process dynamically using Fluent API

Kris Verlaenen do-not-reply at jboss.com
Tue Dec 6 16:00:25 EST 2011


Kris Verlaenen [http://community.jboss.org/people/KrisVerlaenen] created the discussion

"Re: Creating process dynamically using Fluent API"

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

--------------------------------------------------------------
Hi,

Could you share how you then try to load this process into your knowledge base?

To be able to execute a process, it should also be "compiled", which means that we need to do some additional processing in some cases (like for example the script node) to make sure we can execute it as fast as possible.  The easiest way to do this is to just use one of the kbuilder methods to load the process.  In this case, you can do:

|  |  | RuleFlowProcess process = factory.validate().getProcess(); |
|  |  | System.out.println(XmlBPMNProcessDumper.INSTANCE.dump(process)); |
|  |  | KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder(); |
|  |  | kbuilder.add(ResourceFactory.newByteArrayResource(XmlBPMNProcessDumper.INSTANCE.dump(process).getBytes()), ResourceType.BPMN2); |
|  |  | KnowledgeBase kbase = kbuilder.newKnowledgeBase(); |

For a full example, see here:
 https://github.com/droolsjbpm/jbpm/blob/master/jbpm-bpmn2/src/test/java/org/jbpm/bpmn2/ProcessFactoryTest.java https://github.com/droolsjbpm/jbpm/blob/master/jbpm-bpmn2/src/test/java/org/jbpm/bpmn2/ProcessFactoryTest.java

Kris
--------------------------------------------------------------

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

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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-dev-forums/attachments/20111206/a21a1c05/attachment.html 


More information about the jboss-dev-forums mailing list