3 Replies Latest reply on Jul 26, 2013 1:23 AM by ashpcs

    Integrating jBPM in Existing Web Application along with Guvnor / Designer

    ikrambabai

      Dear Commuity,

       

      I'm into the jBPM /Guvnor/Designer suite for about two months now - so still a newbie - However, I feel like I have convered a good (at least horizontal) space. I have got many questions on the overall best practices that one should use to use various components of the suite.

       

      Background:

       

      We are evaluating jBPM for executing processes that will dump data from some big data servers, do some manipulation and extract and dumpt the refined results into an RDBMS - The processes shoudl execute at cetain frequencies - lets say every 1 one - So we need a process triggering mechanism to invoke the BPMN2 process through jBPM runtime - we use quartz for that. The actual process will be designed by users using the Oryx designer that's embedded in Guvnor and then saved in the Guvnor's tables. We do not use the Human Task Service (not at least now) or any other rule base API that Guvnor exposes. Our Users will primarily be using Designer App to write the processes, compile and let the jBPM consume them.

       

      Following is the high-high level design on which my questions below are based.

       

      Tomcat Instance 1

      |-----------------------------------------

      |       My Web App              |

      |       Usual Supsects          |

      |       (Hibernate/Spring)       |

      |                                        |

      |                                        |           

      |                  +                    |

      |           jBPM Core             |

      |       (Engine/Runtime)        |

      |     (Work Item Handlers)    |                          <---- In Instance1 we build jBPM Knowledge Base by getting BPMN2 Processes designed and stored in instnce 2 below

      |_______________________|

       

       

       

      Tomcat Intance2

      |-----------------------------------------

      |       Guvnor + Designer      |

      |                                        |

      |                                        |

      |                                        |

      |                                        |           

      |                                       |

      |        Users Design            |

      |      BPMN2 Processes      |

      |       Save and Build           |

      |______________________|

       

       

      1.  When to build the kBase in Instance1?

       

      Knowledge Base is what jBPM Core knows and cares about - once built, the core engine can pick any process using its ID and get it executed - Process are designed in Instance2 above. Once desgined, committed and package is built, how do I tell jBPM core in Instnace1 to rebuild its knowledge base so that the latest defintion of the changed proces is avaiable to it on the next cron trigger?  Is there a hook that Guvnor App provides that kicks in Instnace1 right away as soon as the package in instnace2 is built?

       

      The two easiest answers that I do not want to follow can be these.

       

      a. Build Knowledge Base in instance1 every few minutes. Get latest process defintion from Instance2 every 5 mintues, for instnace: I dont like this option (and Im sure most of you won't). What if something bad happens during such a high frequency operation and kBase is not built successfully?

       

      b. Currenly what Im doing is that everytime the user comes to the page (in Instance1) where process names are listed (from kBase), I re-create the kBase. Not a brilliant way of doing I agree - What if the users neverf comes to that page and just sings out after the kBase in Instnace2?

       

      So please let me know if there is a nice way that I can build my kBase in Instance1 on every Prcess/Package Build in Instnace2.

       

      2.  What Happens to an in-progress process when changes are done to an exisiting process, package built and kBase built in instance1?

       

      Let say I know when and how to build my kBase - but then there can be some process which already started on the older version of the processes jBPM took from older kBase for execution? Will there exection be terminated or the runtime will execute the older version of the process and pick the new only in the next exection (not the current one)?

       

      3.  Versioning: Is there a way to tell jBPM to execute a particular version of a process?

       

      4.  Partial BAM Reports? Possible?

       

      The Business Activity Modeling tables (nothing complex  2/3 tables - one being PROCESSINSTANCELOG) are populated whenever the jBPM exection flows enters and exits a particular node. It works nicely except when one node's execution (say a Service Node) faces a problem. Just yesterday, I faced this problem. Let me explain. Suppose a process is in execution and when it reaches to node 5 for example - once of who's parameter is a big data query and that query had a syntax error. Obviously exceptions were thrown from that Service Node - But jBPM didn't save anything in the BAM tables - not even for the 4 nodes that executed without any issue.? Why? Is it by design or its a bug? How do I know what happened to that process when nothing is logged?

       

      5.  Guvnor --> Web App Integration and Authentication

       

      As I have mentioned, I have fully functional in-production web application with security - of course. I would like to use the same credentials when authenticating a user to guvnor app sitting in Instance2 - Please suggest how this should be done and provide reference to articles if any. I sure cannot (and do not want to) write code into Guvnor - there must be a good out-of-the-box method to do this.

       

      Another facet of the issue is to give the user once experience - when he jumps from My Web App to Drools-Guvnor app - he shouldn't feel it.

       

      Or put in cude terms, the URL should not change from

       

      http://webapphost:8080/webapp

       

      to

       

      http://guvnorhost:8080/drools-guvnor

       

      THis problem we solved using iframe ... so all I have to do is to divert the user to a jsp page that contains this like

       

      <iframe src="${viewUrl}" width="100%" height="750px"></iframe>

       

      My URL remains the same (webappone) and drools appears within the iframe.

       

      Is that a good idea though? Any better suggestions than that?

       

      6.  Keeping jBPM  withing the Web Application or Seprate?

       

      As the diagram above shows my jBPM runtime/core runs within my Web App - Since jBPM creates only once process per execution (not matter how many parallel "logical" exection flows might exist in the process), do you guys think its ok to do so? Or will it be a good idea to use jBPM Core separately?

       

      7.  Process Execution Survie Instance 1 restart?

       

      8.  JNDI Resources? Can I get the same using Spring?

       

      Im using tomcat and in there I use Bitronox Transaction Manager for jBPM BAM / Core table's commits. The way I have configured the data source for BTM to work is by editing the server.xml and context.xml files - files that usually are not expnosed to your CATALINA_BASE - especially in bigger organizaitons where one tomcat installation (CATALINA_HOME) is used to configure hundres of CATALINA_BASES. Usually its very hard to convince the system admin for changes into such core files. It would be lovely if I donot have to do any changes in these two files and I still have the JNDI resources defined? Can I do this withing my web app? I know some of you will jump directly to Spring (whchi I use thoroughly) - but will BTM work with that kinds of JNDI resource defintion. If anyone has worked on it, please share.

       

      9. Drools Guvnor + Designer Browser Compatibility.

       

      That one was a real pain - I like Chome/Mozilla personally - but we will have to endup using IE due to corporate policies. Guvnor and Designer do not work in IE - I had to do a script that installs a Chrome frame (if not already) withing IE when the user first visits the Guvnor page. But, can we not get Droosl Guvnor and Designer working in IE as well?

       

      10. What are my limitations with Tomcat?

       

      Drools + Deisgner works perfectly in tomcat/BTM for me (it gave me some issues with some minor verions of tomcat but 6.0.37 that Im using is good). Do you think I might hit a block using jBPM/Drools in tomcat -someting that was primarily designed and tested on jBOSS?

       

       

      Regards,

      -Ikramullah Khan