4 Replies Latest reply on Jul 19, 2010 8:26 AM by soheildowlatshahi

    Failure in ignaling a state in a process which has timer

    soheildowlatshahi

      I have defined following state in my process:

       

      <state name="activity.investor.registeration.inquiry.suspend" >
              <transition name="investor.inquiry.replied" to="activity.investor.registeration.inquiry.evaluate"/>

       

              <transition name="investor.inquiry.timeout" to="activity.investor.registeration.inquiry.check">

                 <timer duedate="5 minutes" />

       

              </transition>

       

      </state>

       

      Unfortunately I can not signle the process when it is in this state. The workflow engine give me an error containing this message: inactive-process or state. but when I  remove the timer section, I can signal it and it works properly!

       

      Is it fixed in JBPM 4.4?

       

      Thanks

      Soheil

        • 1. Re: Failure in ignaling a state in a process which has timer
          swiderski.maciej

          I don't think it is a bug, you can signal such wait state, you just need to look up for it first.

           

          String executionId = processInstance.findActiveExecutionIn("wait state").getId();
          

           

          and the use this executionId when signaling. Timer will be destroyed as well.

           

          HTH

          • 2. Re: Failure in ignaling a state in a process which has timer
            soheildowlatshahi

            Dear Maciej Swiderski

             

             

            I have changed my code as you had suggested alreay and I tried to signal the execution Id of the wait state activity instead of signaling the process itself and it didn't throw any exception. At first it seams that it works but later I have noticied that the no transtion in wait state is traveresed and the state of the process isn't changed.

             

             

            you can see part of my process definition here:

             

             

             

            <state name="activity.investor.registeration.inquiry.suspend" >
                    <transition name="investor.inquiry.replied" to="activity.investor.registeration.inquiry.evaluate"/>



                    <transition name="investor.inquiry.timeout" to="activity.investor.registeration.inquiry.check">
                        <timer duedate="50 minutes" />
                    </transition>
                </state>

             

             

            and here is my code for signaling the above mentioned wait state:

             

            processInstance = executionService.findProcessInstanceById(processId);

            // it is not null and have a value


                            if (processInstance != null) {


                                String executionId = processInstance.findActiveExecutionIn("activity.investor.registeration.inquiry.suspend").getId();

                     

            // the executionId is also not null and have the value.

                                if (executionId != null) {
                                    executionService.signalExecutionById(executionId, getProcessVariables(parameters));
                                }
                            }


                            log.info("signal process state succeed!");

             

            Neither investor.inquiry.replied nor investor.inquiry.timeout is not called and traversed by the workflow engine and the process remains again at "activity.investor.registeration.inquiry.suspend" state.

             

            I should again notified that if there is not a timer in the wait state , on can signal it by the following code without any problem and it works:

             

            executionService.signalExecutionById(processId, getProcessVariables(parameters));

             

            But if there is timer in the wait state activity (like one that mentioned aboved) the calling of this method causes an exception and the message of due to this error  that the current status of the process is inactive-scope.

             

             

             

            Thanks

            Soheil

            • 3. Re: Failure in ignaling a state in a process which has timer
              swiderski.maciej

              You could signal it with the signal name that points to the transition you want the activity to take.

               

              Please remember as well that once you signal it (by using executionService.signalExecutionById()) updated process instance will be returned and should be already in another place of the process.

              If you will still have issues with this please enable logging (debug) of jbpm and attache them here to illustrate whole execution.

              • 4. Re: Failure in Signaling a state in a process which has timer
                soheildowlatshahi

                Thank you Dear Maciej Swiderski

                 

                It works now, but I think that the method signalExecutionById can be better implemented to avoid additional depdencies for signaling a process.I thinks that sending the process Id is sufficient. I mean  that if we can signal a process only by its identifier, the signaling mechanism will be more independent from the process details.

                 

                Best

                Soheil