9 Replies Latest reply on May 9, 2011 9:37 PM by chalukya

    Single Instance of Process

    Abhinav Sharma Level 2

      There is a requirement that I need just a single instance of a process (long lived). If user tries to invoke process again it should not get invoked. A kind of singleton process. Is it possible?

       

      Thanks,

      Abhinav

        • 1. Re: Single Instance of Process
          chalukya Level 2

          Hi Abhinav,

           

          Can u brief a bit more on this, what exactly do u want.

          A new process instance is always created when a user invokes a process, but u can write logic to execute steps for fisrt time.

           

          Regards--

          Chalukya.

          • 2. Re: Single Instance of Process
            Abhinav Sharma Level 2

            Thanks Chalukya !!

             

            I have a process P1. It is monitoring a table in the database at regular fixed (5 mins) intervals, looped using wait point. Whenever a record is pushed in that table, P1 sends an email to admin, delete that record from the table. Now if TWO(2) instances are running of same process P1 then it may be the possibility that both instances checks table at same time and TWO(2) similar mails are sent. Situation would be more worse it more instances are running (multiple times invoked). So my concern is that if there is a way so that we can make a process so that it can only be invoked single time ??

             

            Or please suggest me the other work-around for this situation.

             

            Thanks,

            Abhinav

            • 3. Re: Single Instance of Process
              chalukya Level 2

              Hi Abhinav,

               

              You can have a column in your database say FLAG, which is false initially.

              When your process P1 is invoked for the first time(if FLAG is false) then update FLAG as true and take a decision to continue with your for loop.

              Now when another instance of P1 is invoked then again check for FLAG if true then skip for loop.

               

              Hope this will Help.

               

              Regards--

              Chalukya.

              1 person found this helpful
              • 4. Re: Single Instance of Process
                Abhinav Sharma Level 2

                Right this is the nice way to implement this. But I have to delete that record, no flag is bieng maintained as of now & its a wierd requirement of my client.

                 

                So I was going thru that way aka Singleton Process.But I think if this is the case then I have to convince my client for flag option.

                 

                Thanks Chalukya.

                 

                Currently I was looking at http://localhost:8080/soap/services/TaskManagerQueryService?wsdl service. I think it could help me in getting a solution for it.

                 

                -

                Abhinav

                • 5. Re: Single Instance of Process
                  chalukya Level 2

                  Try configuring your P1 process under

                   

                  From Admin UI

                   

                  Home > Services > Applications and Services > Service Management

                   

                  To Single Instance for all Request Option under Pooling.

                   

                  Not sure will this help, give a try.

                   

                  Regards--

                  Chalukya.

                  1 person found this helpful
                  • 6. Re: Single Instance of Process
                    grndragon Level 1

                    I'm afraid the answer is no.

                    • 7. Re: Single Instance of Process
                      Abhinav Sharma Level 2

                      Hi, I went through the Service Management control in admin panel. There is a configurable pooling section that has three options in Request Processing Strategy:

                      1. Single Instance for All requests: As it states it should have worked, but it didn't. Each time I was invoking process a new instance was being created. Need more help on it.
                      2. New Instance for each request : Default option. Will create new instance for each request, as stated.
                      3. Pooled Instances for all the requests: Configuring it makes my problem partially solved. Setting max instances to 1 it does allow only single instance for a request. If new request came it will queue it and waits for the first process to stop. So always single instance will be running.

                       

                      I think making a component for livecycle which checks the status of the process using QyeryService (@ this link). This component will be placed in the beggining of the Process. It will get the status. If Process is running (instaceCount>1), kill itself. I dont know if there is a way to killing a process in workbech. I have thought to route it to the node that has no further way to go. Might be it's a wrong way to do this. Please remark/suggest.

                       

                      Thanks,

                      Abhinav

                      • 8. Re: Single Instance of Process
                        grndragon Level 1

                        It would be easier if you just stop the current instance rather than kill

                        the running one. And instead of making a component, you can also detect the

                        running instance via JDBC service.

                         

                        Hope this helps.

                        • 9. Re: Single Instance of Process
                          chalukya Level 2

                          Hi Abhinav,

                           

                          I think this would be a better aproach.

                          Killing a process from workbench is not possible, you have to customize your services to do this.

                          And I am not much aware of that .

                           

                          or do we have any services (any wsdl service) to kill or stop the process ?? 

                           

                          Regards--

                          Chalukya.