2 Replies Latest reply on Mar 26, 2015 9:05 PM by Otávio Garcia

    How to orchestrate a process flow with decider to back to previows step?

    Otávio Garcia Newbie

      I need to consume some webservices, and for each webservice consumed, I need to collect the result and store into a database. But there is one webservice that I need to consume, and if the result was NO, I need to waiting some minutes and ask again, and again. I only can process to next step when the return are YES.

       

      I've posted a question at Stackoverflow, but without any reply: http://stackoverflow.com/questions/28976857/how-to-consumes-a-webservice-in-a-loop-decision-waiting-some-minutes

       

      My process are described below.

       

      P2HF7.png

       

      Thinking in this image, I've created a decider to check the result from B webservice. And if the result is NO, I'm redirecting to B again. But I got this exception:

       

      JBERET000607: The step step1 would form a loopback in sequence: [stepA, stepB]

       

      How I can do this flow as described in the image? There are some way to consumes the same webservices many times until Available is NO?

       

      Thanks in advance.

        • 1. Re: How to orchestrate a process flow with decider to back to previows step?
          Cheng Fang Master

          The relevant part of batch spec (JSR 352):

           

          8.9.3 Loop definition

          The specification prohibits ‘next’ and ‘to’ attribute values that result in a “loop”. More precisely, this means that no execution element can be transitioned to twice within a single job execution.

          This wording is purposely written this way rather than merely saying no execution element can be executed twice within a single job execution. Say “step1” executed to completion during an initial execution which ultimately failed, and upon restart we transitioned past “step1” without executing it since it had already completed, but we subsequently transitioned (back) to “step1”. This may only be a single execution of “step1” during a single job execution, but it still violates the looping prohibition.

           

           

          The runtime may detect potential loops in an initial validation phase, as described in section 13.1, or may only detect loops once they occur.

           

           

          So your job flow would violate the batch spec.  It may even cause your job to hang and wait forever, if the targeted web service never returns. Other options you can try is to implementing your logic inside one single step, or to avoid polling by registering some notification callback in your application.

          • 2. Re: How to orchestrate a process flow with decider to back to previows step?
            Otávio Garcia Newbie

            Cheng Fang, thank you for your reply.

             

            Hmm, so I will change my project to avoid repeated operations.

             

            Thanks to explain.