Question


1986
US
Last activity: 28 Dec 2018 15:43 EST
How to find and save a Thread details and then kill that thread on user action
Hi, I want to find and save current running thread details into variables and then on user action like on click of a button, I want to kill that previous thread. The main reason for this is.. one of the application that we are automating is very slow and it hangs few times and it runs in the background. If the user feels that it been hanging there for a while, there should be a way to kill that previous thread and start the process again. Can anyone Please let me know how to achieve this using Pega Robotics. Thanks,
-
Like (0)
-
Share this page Facebook Twitter LinkedIn Email Copying... Copied!


Pegasystems Inc.
US
This would require C# on your part as it is not available within the product. If you are simply looking to terminate a specific adapter, then you can do that by calling Stop on the adapter. You can also use the static method Process.GetProcessesByName to locate a specific process and Kill it.
-
Lochana Durgada Vijayakumar


1986
US
Hi Sasnt,
Thanks for your reply.
I don't want to kill the whole process. To restart the our process it will take at least 5 mins to launch the application and login.
So, I just want to kill the running thread only. Please provide me C# code or any reference to achieve it.
-
Lenka Rolinek SORNALATHA R Vikas Thangellapally


Excellus BCBS
US
Hi ParamKonuganti,
I have a similar scenario to handle. If in case you were able to accomplish this, can you please guide me on how to achieve this.
Thanks,
Varun Podaralla


1986
US
Hi Varun,
Sorry.. we couldn't achieve that. Please explain the scenario, we can try to see whether we can achieve the desired behavior in another way.
Thanks,


Excellus BCBS
US
Hi ParamKonuganti,
Thanks for the response. In my scenario I wanted to provide an option to the user to immediately halt the execution at that instance without even completing the execution of the current step. for e.g. when a user starts processing a card by clicking on start process, automation has to complete 12 steps and when user realizes at step 3 that this is not the correct card to be processed, then we should be able to provide a button to the user to halt the automation at that instance without even completing step 3. Please let me know if there is any way we can kill that thread and initiate a new one or anything similar to this approach.
Thanks,
Varun Podaralla


1986
US
Hi Varun,
Please try and see whether the below helps
In your case, Considering every step of the 12 Step process as separate automation, we can proceed or Stop that particular step using a Flag, which is set only when the user clicks Stop Button.
The execution flow of First Button Automation and Stop Button Automation should be Asynchronous. If it single Project, using GC boolean flag. If it multiple project solution, use the Global Dictionary boolean variable.
Thanks,


Pegasystems Inc.
US
This functionality can be implemented using an activity. Once you start an activity, you have the ability to cancel an activity. The StartActivity method returns a value that you can then pass to the CancelActivity method of the Interaction Manager component. Cancelling an activity will stop the automation at the next execution path.