3 Replies Latest reply on May 24, 2006 9:33 AM by Koen Aers

    Pausing JBPM process execution (JBPM Newbie)

    Imran Naqvi Newbie

      I have a simple process definition of 5 linear tasks, each one of them having an action triggered on their node-enter events.
      I am trying to programmatically pause the execution of the process in the action handler of the first task by calling executionContext.getProcessInstance().suspend()
      But this makes no difference as execution still steps through all other actions of the subsequent tasks. The isSuspended value for the ProcessInstance does become true but execution doesnt stop.
      Can anyone tell me the correct way to pause a process execution?
      Thanks in advance.

        • 1. Re: Pausing JBPM process execution (JBPM Newbie)
          Ronald van Kuijk Master

          the correct way is by using the api as you did, just not from within actionhandlers.

          • 2. Re: Pausing JBPM process execution (JBPM Newbie)
            Imran Naqvi Newbie

            Thanx for your reply. Actually I want to have the pause/resume occur in response to some preprocessing before node execution (which checks for availibility of resources). The process is paused if required resources are unavailable, and resumed when the resources do become available. Since this is a generic activity and must occur before execution of every action, the best solution that comes to mind is to have the resource check occur either in transition handlers or in the node-enter event handlers.
            Theres no way I can think of for me to step in between nodes to check availibility of resources from outside. Can u tell me if I can do this from outside of any actionhandlers?

            • 3. Re: Pausing JBPM process execution (JBPM Newbie)
              Koen Aers Master

              I think the way to do this could be to use a state combined with a timer. The timer would expire immediately and have a repeat cycle that you need to periodically check for the availability of your resources. If they are available, the action in your timer signals the processinstance to move out of the state and continue to the next state.