5 Replies Latest reply: Mar 25, 2011 7:52 AM by Mauricio Salatino RSS

jbpm5: one session or multiple sessions

derek lee Newbie

Hi, all


in the jbpm-doc chapter 4, there are some contents about session.  can anyone tell the different between one session and

multiple session? if the whole application use one session, what problem can cause? does the process influence others?


because i see word 'independent ' in the doc, is there 'dependent' situation?




  • 1. jbpm5: one session or multiple sessions
    Kris Verlaenen Master

    Process instances could influence each other, for example by signaling events, by changing globals or by putting / changing data in the session.  In general, you can use one session for multiple process instances.  Reason to create multiple sessions are for example scalability, or when you want to make sure process instances cannot inadvertedly influence each other.



  • 2. jbpm5: one session or multiple sessions
    Marie MM Newbie



    we are now deciding whether how to use sessions. I see these general possibilitites:

    1. one session for all: which doesn't seem good solution based on Kris' answer, since we don't want processes influence each other by any chance
    2. new session created each time the session is needed
    3. one session for one process: for this solution I don't know where to save connectin between session and process instance. I imagine I have taskId or workItemId, from this I can get processInstanceId, but how I can get the information in which session it belongs?


    What is your opinion on these possibilities?


  • 3. jbpm5: one session or multiple sessions
    Mauricio Salatino Master

    Hi Marie,

    1) don't take kris words in a bad way, there are some situations when you really need to have processes in the same session in order to handle interprocesses communications. It doesn't means that there are buggy behaviors when you run two or more processes in the same ksession.

    2 and 3) Could be expensive if you think about persisting multiple session and based on the process you need to know which one load again. You will need to implement a mechanism to keep track which session -> which process


    I personally think that you will start to understand more the posibilities that you have when you start looking at the persistence configurations and how they work.



  • 4. jbpm5: one session or multiple sessions
    Marie MM Newbie

    Thank you for answer.

    Just to make sure, what do you mean by persitence configuration exactly?

  • 5. jbpm5: one session or multiple sessions
    Mauricio Salatino Master

    If you have wait states/safe points in your processes you will need a way to persist/store in a database the status of your business processes.

    Take a look at the persistence section in the docs: http://docs.jboss.org/jbpm/v5.0/userguide/ch08.html