1 Reply Latest reply on Jun 6, 2011 11:31 PM by Mauricio Salatino

    Using jBPM5 in JEE6

    Tair Sabirgaliev Newbie

      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?

        • 1. Re: Using jBPM5 in JEE6
          Mauricio Salatino Master

          Hi there,

          your question is a really good question. My personal answer is: it depends.

          It really depends on how you are planning to use jBPM5. The project let's you choose about how to manage the relationship between your processes and your sessions. For example:

          You can create a session per user and handle it's internal workflows or you can create a big session that handle a lot of work.

          You can keep track of the session that it's handling the process in a very simple map.

          Cheers

          1 of 1 people found this helpful