JBoss Community

Using jBPM5 in JEE6

created by Tair Sabirgaliev in jBPM - View the full discussion

What is the best way to interact with persistent jBPM5 engine in JEE6 application?

 

I'm learning jBPM5 and by the way trying to embed it in a JEE6 web application to build a simple BPM console . So far I come up with these design:

 

@ApplicationScoped KnowledgeBase

 

@???Scoped StatefulKnowledgeSession

 

@RequestScoped ProcessInstance

 

I'm stuck with deciding the scope for StatefulKnowledgeSession, because I can't understand the relation between ksessions and processInstances. I looked into code of jbpm-gwt-console and found that it uses single application-wide ksession. It is loaded from DB if found with id=1, otherwise new ksession is created.

 

So my questions are:

1) Does a processInstance exclusively belong to a particular ksession?

 

2) If (1) = YES. Imagine I have a processInstanceId, then how I load the ksession it belongs to?

 

3) If (1) = NO, is it safe to use a new ksession to operate on an already started processInstance?

Reply to this message by going to Community

Start a new discussion in jBPM at Community