3 Replies Latest reply on Jul 29, 2013 8:39 AM by fellowtom

    Need help with persistence and initialisation

    fellowtom

      Hi all,

       

      I have some questions wich I cant answer myself. What is the difference when initializing a process instance with Knowledgebuilder/KnowledgeBase/.. or with JBPMHelper and the RuntimeManager? Or better to say, when to use which one?

      I just want to use jBPM in my own application. Persistance can be handled first in H2 inmem db. Later it will be handled with other db on a server. But atm I just want to test some process-scenarios. If I setup my process with that knowledgebase/... all events/task will work, but im not able to handle a usertask (cant get it working). If I set it up with JBPMHelper and the RuntimeManger the process always terminates when reaching for example a timer(probably all wait-states). No errors or something. Process just terminates. I think its just some kind of persistence problem, but I cant figure it out.

      I'm using jBPM 6.0. The initialization of process is done like in chapter 4 (manual) or in type of JBPMHelper like the given exampleprocess "HumanTaskExample". If I run this example it works. But even if I copy this processfiles (bpmn+java) in own project it wont work.

      Can somebody give me a hint?

        • 1. Re: Need help with persistence and initialisation
          fellowtom

          After testing a lot of stuff i was finally able to handle my usertasks the way I wanted. But there is still 1 thing I dont understand. The whole process with different tasks and gateways works fine, but at the moment it reaches a timer, it still just terminates without any error massage. I have no idea why. Timer should be set up fine (even if i set a timerduration directly).

           

          <intermediateCatchEvent id="_14" name="Timer" >
               <timerEventDefinition>
                    <timeCycle xsi:type="tFormalExpression">#{timerValue}###0</timeCycle>
               </timerEventDefinition>
          </intermediateCatchEvent>
          

           

          If somebody could explain that behaviour or help me to avoid it, i would be very happy. Thanks

           

          tcolditz

          • 2. Re: Need help with persistence and initialisation
            swiderski.maciej

            First of all to get most of the solution you should use RuntimeManager in most of the cases. JBPMHelper is more for test purpose to simplify the setup and manual Kbase creation is the last (and lowest level) approach if you can't use the two mentioned first.

             

            Would be good if you could provide more details what is not working as expected ... but if you already found the way to make it to work that's even better.

             

            When it comes to timers, what you mean process terminate? Does the process instance is aborted or? In general timer is considered as wait state and thus will return the execution to the caller. But will be automatically resumed when timer expires.

             

            HTH

            • 3. Re: Need help with persistence and initialisation
              fellowtom

              Hi Maciej,

               

              thanks for your reply. Since I'm new to BPM I made a lot of mistakes. So I feel pretty ashamed about the mistake I've done. My process went through several timers, gateways and usertasks. After that it reaches a timer. Then the java-program always terminated. I had a

              System.exit(0);
              

              implemented from copy-paste somewhere. But to understand the workflow behaviour better. All tasks are handled in the same thread since a wait-state (usertask,timer,signal,receive) is reached?! So my java-main code was not finished since I reached such a wait-state because its the same thread? By reaching the timer my code goes on with execution and programm ended, right?

              At least now its working fine and I'm sorry for wasting time with such mistakes.

               

              Thank you very much.

               

              With kind regards,

              tcolditz