Example #1
0
        public void AddRunningProcess(CustomerMicroservice customerMicroservice)
        {
            try
            {
                ProcessStartInfo configuredProcess = ConfigureProcess(customerMicroservice);
                Process          createdProcess    = CreateProcess(configuredProcess);

                var runningCustomerMicroserviceProcess = new RunningCustomerMicroserviceProcess(customerMicroservice, createdProcess);
                _runningProcesses.Add(createdProcess.Id, runningCustomerMicroserviceProcess);
            }

            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #2
0
        public void StopProcess(int pid)
        {
            try
            {
                if (_runningProcesses.ContainsKey(pid))
                {
                    RunningCustomerMicroserviceProcess selectedRunningProcess = _runningProcesses[pid];
                    Process runningProcess = selectedRunningProcess.Process;

                    if (!runningProcess.HasExited)
                    {
                        runningProcess.Kill();
                    }

                    _runningProcesses.Remove(pid);
                }
            }

            catch (Exception ex)
            {
                throw ex;
            }
        }