1 2 Previous Next 24 Replies Latest reply on Feb 9, 2006 3:04 AM by Rainer Alfoeldi

    How to suspend and resume a process

    niu jiaqing Newbie

      Hello

      How to suspend a process instance in the middle of the workflow and resume it ?

      I have a process in JBPM3.0, for some reason , the process instance must be suspended then resume it later.

      How to handle this?

      Thank for any answer.

      vincent


        • 1. Re: How to suspend and resume a process
          Rainer Alfoeldi Novice

          Add a wait state in your workflow and signal the token later on.

          • 2. Re: How to suspend and resume a process
            Ronald van Kuijk Master

            Or look at 3.1alpha. afaik, there is functionality to suspend and resume. It is alpha, so the code might not be finished.

            • 3. Re: How to suspend and resume a process
              niu jiaqing Newbie

              Thanks for you reply..

              to RAlfoeldi:
              I mean i want to control this process instance, suspend and resume it at any time or at any step.

              to kukeltje:
              Thanks, i will look at it.Maybe it work..

              • 5. Re: How to suspend and resume a process
                Rainer Alfoeldi Novice

                Hi Vincent,

                its basically a question of 'does your node signal the next transition by itself or does it return?'

                jbpm will execute a token until a node returns from the signal() method. (if your process forks it will follow all paths and then return.) if you want to decide at runtime to suspend the process use a node with an action and either return from the execute() method or call a transition depending on what you want to do.

                does this answer your question?

                Greetings Rainer

                @zhgd: 'I'm also waiting ...'? Ah, yes. And what for?

                • 6. Re: How to suspend and resume a process
                  Marcos Donato Newbie

                  Hi all,

                  i think my question is like yours, but a little different.

                  I don't want to handle it, i need a delay time like 20 days or any thing else, and i've tried to do it with "timer" tag on a simple node tag!

                  but the timer has no actions and when the flow reachs this node, the delay timer dont work and bypass the node with the default transition, going to the next task !

                  if anyone knows how can i do it, without handling it and without a explicity signalling it, i'll be very happy!

                  thanks

                  • 7. Re: How to suspend and resume a process
                    Rainer Alfoeldi Novice

                    Hi mdonato,

                    why doesn't the timer work? or better: how are the timers you tried defined?

                    Rainer

                    • 8. Re: How to suspend and resume a process
                      Marcos Donato Newbie

                      Hi,

                      i'm trying to do another test with node type "state" ... i've done it with node type "node" and dont work !!!

                      i'll put the result of the test here soon !!

                      • 9. Re: How to suspend and resume a process
                        Marcos Donato Newbie

                        Hi,

                        i've tried this one:

                        <state name="aguarda">
                         <timer duedate="3 minutes" transition="confirmar-fechamento"></timer>
                         <transition name="confirmar-fechamento" to="confirma-fechamento"></transition>
                         </state>
                        


                        and this one :
                        <node name="aguarda">
                         <timer duedate="3 minutes" transition="confirmar-fechamento"></timer>
                         <transition name="confirmar-fechamento" to="confirma-fechamento"></transition>
                         </node>
                        


                        and dont works .... how can i do a delay ?

                        • 10. Re: How to suspend and resume a process
                          Rainer Alfoeldi Novice

                          Did you check if the timer was created (check the Timer table in the db)?

                          Is your SchedulerThread running?

                          • 11. Re: How to suspend and resume a process
                            Marcos Donato Newbie

                            Timer table was not created !

                            And my timer thread is running !!!

                            here is the part of the flow

                            <task-node name="confirma-abertura">
                             <task name="task1" description="Confirmar abertura de admissoes" swimlane="Supervisor-Cliente"></task>
                             <event type="node-leave">
                             <action name="notificar" class="br.com.glr.jbpm.handlers.MailToSwimlaneActionHandler" config-type="bean">
                             <from>admin@glr.com.br</from>
                             <swimlaneNames>Supervisor-Celula;Diretor-Operacional;Diretor-Geral;Gerente-Cliente;Operador-Celula</swimlaneNames>
                             <subject>Confirmada a abertura de admissoes</subject>
                             <message></message>
                             </action>
                             </event>
                             <transition name="confirmar" to="aguarda" ></transition>
                             </task-node>
                             <state name="aguarda">
                             <timer duedate="3 minutes" transition="confirmar-fechamento"></timer>
                             <transition name="confirmar-fechamento" to="confirma-fechamento"></transition>
                             </state>
                             <task-node name="confirma-fechamento">
                             <task name="confirma" description="Confirmar fechamento de admissoes" swimlane="Supervisor-Cliente" ></task>
                             <event type="node-leave">
                             <action name="notificar" class="br.com.glr.jbpm.handlers.MailToSwimlaneActionHandler" config-type="bean">
                             <from>admin@glr.com.br</from>
                             <swimlaneNames>Supervisor-Celula;Diretor-Operacional;Diretor-Geral;Gerente-Cliente;Operador-Celula</swimlaneNames>
                             <subject>Confirmado o fechamento de admissoes</subject>
                             <message></message>
                             </action>
                             </event>
                             <transition name="sim" to="termino"></transition>
                             </task-node>
                            


                            • 12. Re: How to suspend and resume a process
                              Rainer Alfoeldi Novice

                              The timer TABLE was not created? Or there is no entry in the existing table?

                              If you don't have a timer table you don't have timers, but then you should have lots of exceptions...

                              Try setting a break point on the enter-node event and check whats happening. I do use timers extensively and they work perfectly... but I don't define them in the workflow, they're dynamically generated.

                              But from what I've understood of timers they ought to be created (in the db) on the enter-node event and removed (canceled) on the leave-node event. Actually to actions are implictly defined for these events. => set a break point and have a look.

                              Rainer

                              • 13. Re: How to suspend and resume a process
                                Marcos Donato Newbie

                                The table exists ... and i've made extensive teste with it in task tags .... and i know that when you put a timer tag , it creates those events .... but in a node tag it dont works ....

                                the other test of the timer is this:

                                <task-node name="task1">
                                 <task name="task1" swimlane="direct">
                                 <timer duedate="30 seconds" repeat="yes" name="lembrete">
                                 <action config-type="field" class="br.com.glr.jbpm.handlers.MailToSwimlaneActionHandler" >
                                 <from>admin@glr.com.br</from>
                                 <subject>Lembrete</subject>
                                 <message>Lembrete de novo</message>
                                 </action>
                                 </timer>
                                 </task>
                                 <transition name="tr1" to="end1"></transition>
                                 </task-node>
                                


                                but its a task timer !!!

                                • 14. Re: How to suspend and resume a process
                                  Alejandro Guizar Master

                                  You've got to save the process instance via GraphSession.saveProcessInstance() for timer records to be inserted in the database and picked up by the scheduler thread. This might seem weird: see the rationale behind it in topic Trouble creating a timer

                                  1 2 Previous Next