[jboss-user] [jBPM] - Re: Confusion between RuntimeManager and new Kie API in jBPM 6

Maciej Swiderski do-not-reply at jboss.com
Wed Aug 7 01:26:51 EDT 2013


Maciej Swiderski [https://community.jboss.org/people/swiderski.maciej] created the discussion

"Re: Confusion between RuntimeManager and new Kie API in jBPM 6"

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

--------------------------------------------------------------
> Serge Huber wrote:
> 
> Thanks a lot for your answer, it helps clarify things a bit. Now I have a few more questions. You talk about setting up a module that aggregates all dependencies, but as I'm dealing with OSGi modules, I cannot know in advance which modules will be deployed or not. Isn't there a way to do this dynamically ?
What I meant is if you have dependent modules they should be aggregated into single one that will have all those modules defined as dependencies so there will be single unit of deployment that will have access to all required classes and assets. And yes, you can do it dynamically where you'll get one to one relationship between RuntimeManager and KieContainer. You can create RuntimeManagers (and then close) them on demand - meaning it is completely dynamic. That's the same way jbpm console does it, allows you at any time to deploy or undeploy units (kjars).


> Serge Huber wrote:
> 
> Also, if I understand you correctly, once I have the KieContainer with all the dependencies, I should use that to initialize the RuntimeManager ? Do I use the RuntimeEnvironmentBuilder to do that ? Any example you could provide would be really great. 
Yes, best way is to use RuntimeEnvironmentBuilder as it allows you to configure all pieces in quite simple way. There are some helpers in RuntimeManager that helps to set it up. Take a look at:
 https://github.com/droolsjbpm/jbpm/blob/master/jbpm-runtime-manager/src/main/java/org/jbpm/runtime/manager/impl/KModuleRegisterableItemsFactory.java KModuleRegisterableItemsFactory  this shall be used to setup KieSessions by RuntimeManager when RuntimeEngine is created. It uses kmodule.xml definitions to find the right configuration.
In general what you would need to do is:
1. create default RuntimeEnvironment using RuntimeEnvironmentBuilder
2. set KModuleRegisterableItemsFactory as registerableItemsFactory on builder
3. set KieBase taken from KieContainer on builder
4. set Clasloader taken from KieContainer on builder
5. most likely set EntityManagerFactory on builder otherwise it will create it's own
6. based on your user and group management set proper UserGroupCallback on builder
That should give you complete environment for most of the cases.

I'll be working on examples in upcoming week so hopefully that will give more insight into details.


> Serge Huber wrote:
> 
> I must say that I'm integrating both the BPM and the Rules part, and my OSGi modules contain both. I'm actually in the process of upgrading from jBPM 4.4 all this codebase so I'm struggling a bit in making sure I'm using the new APIs correctly, as I want to avoid using stuff that might get deprecated (as it seems that some of the jBPM 5 code will be).
Completely understand that, due to the amount of work for 6 we did not have time for documentation and examples but soon these will start coming in which shall make the transition from previous versions easier. Feel free to post questions here so we can make sure code is written in the best way on both ends 

HTH
--------------------------------------------------------------

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

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/20130807/a7543db2/attachment.html 


More information about the jboss-user mailing list