7 Replies Latest reply on Mar 31, 2008 1:37 PM by Tom Goring

    process design advise

    Tom Goring Apprentice

      Hi,

      A couple of questions:

      1) Say I have a review process for a business item (awaiting review, reviewed, etc). Sometimes (say 2% of the time) the item needs to be reviewed again. I'm using the business key of the item as the business key of the process (so I can find it). If I start a new jBPM process with the same key I get problems later on due to Jbpm saying more than one process for a key. Should I reuse the same process and signal it some how to start again? Or should I some how use a different key?

      2) Is there any delete functionality to clear up all ended processes? Can you point me in the direction of it.

      Thanks

      Tom

        • 1. Re: process design advise
          Ronald van Kuijk Master

          1) What is the trigger to have it reviewed again? Maybe you can retrieve it based on a business key and get only running instances. Or that might be an extension to jBPM

          2) You can from the console. Look at what code is behind that to get an impression on how to do it.

          • 2. Re: process design advise
            Tom Goring Apprentice

            1) The trigger is someone coming into the app and saying they want to review it again. My design currently lets the process go to the end state once the review has been done. I'm not sure if I can (or how) move a process from the end state back to the start. And I don't like the idea of leaving the process open just incase a review needs to be done again. So was wondering how best to achieve this.

            2) Ok, I haven't installed the console... I'll have a look at this... you say you can delete them off in there.

            • 3. Re: process design advise
              Tom Goring Apprentice

              Hi,

              If someone could post the API to remove a process instance that would help me a lot. I'm using jboss seam and so installing the console is going to take me a while I think (the jbpm jars are included with seam etc).

              So I call a call like:

              ManagedJbpmContext.instance().removeProcess("my process name")
              


              • 4. Re: process design advise
                Ronald van Kuijk Master

                you don't have to install the console, just look at the source of it... you'll get an idea there, or look at the api docs. Might be something in there to.

                • 5. Re: process design advise
                  s b Newbie

                  (using jbpm-jpdl-3.2.GA)

                  This raises a point I could use some clarification on.

                  We ended up removing the unique constraint:

                  unique (KEY_, PROCESSDEFINITION_)
                  


                  from the JBPM_PROCESSINSTANCE table because it was causing a key violation when we started multiple processes using:

                   jbpmContext.newProcessInstance(String processDefinitionName)
                  


                  We don't understand why we had to do that.

                  If the key must be unique, I would expect to see the key as a parameter in "newProcessInstance(..)" -- in fact, how do you even set the key?!

                  But in answer to tom_goring's question, he could do what we did, remove the unique constraint, then get the ProcessInstance with the highest version number for that key (or maybe there is another field that indicates that a process is not ended).

                  I'd like to learn more how this "KEY" is intended to be used, set, etc.



                  • 6. Re: process design advise
                    s b Newbie

                    Forgot to mention: our database is Oracle.

                    • 7. Re: process design advise
                      Tom Goring Apprentice

                      Yes this was the problem I had with mysql... the constraint failed.

                      So it looks like your approach is to start a new process (with the same key).

                      I think this would work for me provided I could tell which processes (if there were several) were at their end state.