7 Replies Latest reply on Dec 10, 2014 4:35 AM by antonio.giambanco

    Master Slave instances of the same process

    antonio.giambanco

      Hi all,

      I was wondering how to define a process that can have Master instances and slave instances.

      Every master instance can have one or more slave instances. I can receive a slave instance and then even after many days receive its master instance.

      For example:

      I have process as follow (start----task1----task2----task3----end)

      I instantiate my process as slave (reading a incoming parameter), then I check if I already have an other instance of the process as master (its master).

      If not I can execute just task1 in slave instance, if yes I have to check if master instance is completed or waiting in task3 so I can go ahead until the end of the slave instance.

      If master instance after days move from task2 to task3 or ends I have to notify it to all slave instances waiting for it and let them go ahead.

      Do I need to use Per Process Instance RuntimeManager strategy?

      Do I need to use persistence, correlation key or signal events?

       

      Any advice or examples?

       

      Thanks

        • 1. Re: Master Slave instances of the same process
          swiderski.maciej

          I am not sure I got it right what you're trying to do but I would model it with reusable subprocesses. So master process is always started first - as name suggest, so there cannot be slave without master (that's assumption I took for this example). So you have a master process that can sort of never ending loop of being able to create slave processes. It can be realized by a signal intermediate event that waits for a message to go ahead and create a slave and then it goes back again to a waiting state in case another slave should be created. Creation of a slave is done via reusable sub process which essentially means another process instance but with relation to this one as parent process instance.

          Then slave can put itself to a wait state again via signal intermediate event to receive info from master (or other source) when needed.

           

          HTH

          1 of 1 people found this helpful
          • 2. Re: Master Slave instances of the same process
            antonio.giambanco

            Hi Maciej,

            I was not so clear . . .

            I have a process, this process can receive json/rest requests. Inside the request I have information that let me undestand if they are linked with others and if they are main or leaf information.

            So when I receive a request:

            • I check if it is a leaf of a request already processed, or in processing ( waiting because intermidiate tasks are human tasks for example), or that will be received later.
              • if main request already has been processed (process completed), leaf request can go ahead
              • if main request doesn't exist (will be sent from the provider later) or is in processing, leaf request must wait untill main request will be completed.
                • if main request is finishing (last human task before the end is completed), it has to warn all leafs waiting for it.

             

            Hope is it clearer

            • 3. Re: Master Slave instances of the same process
              antonio.giambanco

              Hi Maciej

              maybe correlation key is more appropriete?

               

              Best

              • 4. Re: Master Slave instances of the same process
                swiderski.maciej

                yes, it might be actually good fit for your case (if I got it right )

                 

                HTH

                • 5. Re: Master Slave instances of the same process
                  antonio.giambanco

                  Hi Maciej

                  thanks for answering me . . . since my process is called from an external client, How do I implement correlation? Do I need to create for example a script task between start and task1 for writing the compound correlation key and one script task between task3 and the end for reading the compound correlation key?

                   

                   

                  Thanks again

                  • 6. Re: Master Slave instances of the same process
                    swiderski.maciej

                    correlation key is available by casting ksession to correlation aware interface so you can use that. Unless you utilize REST api then you would need to stick with alternative approach that you described.

                     

                    HTH

                    • 7. Re: Master Slave instances of the same process
                      antonio.giambanco

                      Yes I would use REST api,

                      so I think I will create and a CustomWorkingHandler for doing that

                       

                      thanks