4 Replies Latest reply on Dec 2, 2005 7:48 AM by Koen Aers

    Using jBPM as an application macro controller

    John Baker Newbie

      I have a web application to design that I suspect fits the jBPM paradigm quite well but unsure how to tie the features of the application to the engine.

      Basically, all the standard features of the application need to be controllable from some user created macro (a custom process?). As I stumbled upon jBPM it occurred to me that if all features in the application were implemented as processes (some being just very simple one stage processes like get adress out of address book) then I could hook them together as larger processes that invoke the simple bite size processes as sub processes. This give the advantage of shipping larger prebuilt processes with the app as well as user defined cutom processes built with some internal designer feature.

      I am hoping that there is an easy way to associate a "web flow" (series of pages) with a process node. I assume I would need to design some mediator to hook the current node of the ongoing user process with the current flow. I am looking into Spring web flow to provide this functionality but am still unsure how to tie the two together.

      This seems like a powerful and useful way to design a very flexible application. Also seems to make sense from the specification point of view of getting what the client actually wants. They can define the app as bite-size processes and larger processes that call them. I can then define what actions and flows need to be generated by the subcontracted developers.
      Also as the user is always running some kind of process resuming work where you left off is automatically a feature even between sessions. The session just takes care of which flow to present for the current state of the process.

      Are there any examples of this? Anyone tried something similar? Am I barking up the wrong tree completely as far as jBPM being a practical way to achieve this? Any recommendations?

        • 1. Re: Using jBPM as an application macro controller
          Ronald van Kuijk Master

          I do not have the time now, but tonight I will give you a promissing response

          • 2. Some more thoughts on jBPM as a web flow controller..
            John Baker Newbie

            Some more detail on the problem..

            After a little more thought I am wondering whether it is worth the extra effort to integrate with spring webflow at all. It occurs to me that there is a lot of cross functionality with jBPM. Spring webflow appears to me like a small session persitence only BPM that doesn't allow for multiple paths of execution. I was originally contemplating it as I suspected more than one view might be required per stage in a process but actually I believe now this could be implemented by just having more nodes in a process graph. My process graphs might end up a little more complicated but that just provides more diagramatic documentation without any extra work so is a pro rather than con!

            Now I believe mapping a view to each token would achieve the same result without extra complexity of integrating with yet another product and the result more powerful anyhow. This would allow building of composite views out of the sub-views mapped to each token that represents the current ongoing state of the process instance.

            If each process instance is "owned" by the user (easily implemented as a variable of the process instance) that instantiated it then it is a simple matter to retrieve the currently selected view tree representing where the tokens currently are waiting. The user can easily flip between their currently running processes and these persist across login sessions very easily. No problem with server crashes or leaving half finished work till the next session.

            Another concern is how to map Tasks to views. This is more difficult as tasks may be assigned to other users or unassigned and so don't directly relate to the user who currently "owns" the process. So these don;t fit so neatly into a representation hierarchy as the tokens seem to. However, the "owner" would probably want to be able to view the state of the tasks even if they are waiting for another assigned user to complete the task. Another problem with Task is that it may involve a more complex GUI flow itself which is what originally gave me the idea of mapping jBPM objects to Spring WebFlows. It could be broken down into more nodes with only one Task but this is not taking advantage of the jBPM engine fully and limits the user to perfoming tasks in a prespecified order. The thing I like about tasks is that they can be completed in whatever order the user thinks most appropriate at that moment and that the token continues on its travels when they have all been signalled as done.

            I think there is some real potential here for a very powerful web framework on top of jBPM but need to think through how views map to relevant jBPM objects..

            Thanks for any comments and suggestions in advance..

            • 3. Re: Using jBPM as an application macro controller
              Ronald van Kuijk Master

              I just came home from and have to admit I should not write a detailed answer anymore ;-). I owe you one..... so you have to wait until tomorrow (friday)

              • 4. Re: Using jBPM as an application macro controller
                Koen Aers Master


                Your contemplation is very right. We already thought about using jBPM as a pageflow framework more than one year ago during one of our projects, but the idea was buried because of a lack of time. However, it became alive again some time ago in the context of the JBoss Seam project. I will not explain Seam here, suffice to say that it is a framework bringing together JSF, EJB3 and process flows. You might want to read about it on the Seam homepage. One of the next steps of Seam is to use jBPM not only as the engine to drive the business processes, but also as the navigation engine for the web pages of the application. There is already an implementation that allows this in cvs. Have a look at the test and at the implementation.