'How to start and stop multiple components at once?
I have an application which consists of 3 main components (Background process, database, UI). Now I want to start and stop all components at once.
The apps will be served as an application to endusers. That means that the entrypoint for stopping the process has the be the UI application. Currently I do have two ideas how I could implement this:
- Start and stop background process and database from the UI.
- Start and stop everything by a script.
Are there other solutions that I´m missing right now? Or better - are there any best practices for such a requirement?
Some additional information:
- Background process is written in C++
- UI is written in C# - WPF
- Database runs as Windows service
Solution 1:[1]
I believe it's not quite easy to stop them in the exact same time, even if you create one thread that would take care of this stopping process (which would be the "closest" way attempting to stop them in the same time).
The answer actually depends on a couple of aspects:
- Is there any dependency between the components? Is there any order in which they should be stopped?
- If yes, then you need to go with a sequential approach
- Otherwise, you can create a script that spawns a thread for each component that needs to be stopped, since all 3 components are part of different processes.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Cosmin Ioni?? |
