4 Replies Latest reply on Mar 13, 2012 12:23 PM by Pooja Arora

    jBPM 5 in JBoss 5/6 appserver - start and resume

    Brian Wallis Master

      I'm wondering what the best way to initialise/launch drools flow in an appserver would be. I need to be able to support persistent workflows with transactions so that if I kill the appserver I can restart back to where I was. Long term, cluster failover (which is a similar requirement) would also be required.

       

      I suspect that I should probably use some sort of ejb (stateless session bean or message driven bean) that initialises or resumes the process instances in the ejbCreate() method (since I believe using an ejb can help me support cluster failover as well).

       

      How do you resume a bunch of persisted workflows? They would all either be waiting on an event, the presence of a fact in their session or a return from a call out to a work item (either a domain specific node or a human task).

       

      When you restart, how do you recover the old session objects? Do you create and load a new KnowledgeBase? If the session is persisted I suppose there must be a hibernate query I can make to find all the existing instances. What do I do with them then?

       

      I'm actuallly struggling working out what the right question is :-)

       

      In short, I want to use jBPM in the JBoss appserver and have workflow instances reliably span restarts.

       

      thanks.

        • 1. jBPM 5 in JBoss 5/6 appserver - start and resume
          Mauricio Salatino Master

          Hi Brian.

          Well you have different choices to make that work. You can have a global stateful session where all your processes will leave. If you are using persistence you don't need to worry about your processes, because each time that you interact with them the change of state will be persisted inside the database. If your server goes down, you only need to recreate the session and register all the workItemhandlers, globals and the human task handler (special type of workitem) in order to your process continue working.

          About the objects inside the statefulsession it's the same.. Instead of recreating the session you can store somewhere the session id and when your server restart, you can query the database in order to get the latest snapshot of the session. In this situation you must register all the handlers again too.

           

          Hope it helps!

          Greetings!

          1 of 1 people found this helpful
          • 2. jBPM 5 in JBoss 5/6 appserver - start and resume
            Brian Wallis Master

            Thanks Mauricio!

             

            Got me doing some more reading and a new (to me) session bean type, the singleton session bean, seems to fit the bill for what I want. Can be annotated to startup when the server deploys the ear and seems a good place to do the initialisation.

             

            Not sure about the clustering solution as I would really want workflow sessions distributed across multiple nodes and if a node fails for the flows on that node to be re-started on other nodes in the cluster. But that is all for a future release, our product currently runs in a warm(ish) standby failover configuration and that won't change for a while.

            1 of 1 people found this helpful
            • 3. jBPM 5 in JBoss 5/6 appserver - start and resume
              Mauricio Salatino Master

              Great, I will be writing some blog post and training material about those topics but you need to be patient until I get there.

              This is my current roadmap: http://salaboy.wordpress.com/2011/01/24/announcing-jbpm5-community-training/

              greetings!

              • 4. Re: jBPM 5 in JBoss 5/6 appserver - start and resume
                Pooja Arora Newbie

                Hi Mauricio

                 

                I also want to do similar sort of stuff, i.e. pausing a workflow by persisting its state and later resume it from the same state. However I couldn’t find any basic example to do the same.

                I am using persistence and can see my task states. Can you please guide me towards any example of the same.

                 

                Thanks

                Pooja Arora