mardi 18 février 2020

C# Design pattern for periodic execution of multiple Threads

I have a below requirement in my C# Windows Service.

  1. At the starting of Service, it fetches a collection of data from db and keeps it in memory.
  2. Have a business logic to be executed periodically from 3 different threads.
  3. Each thread will execute same bussiness logic with different subset of data from the data collection mentioned in step 1. Each thread will produce different result sets.
  4. All 3 threads will run periodically if any change happened to the data collection.

When any client makes call to the service, service should be able to return the status of the thread execution.

I know C# has different mechanisms to implement periodic thread execution. Timers, Threads with Sleep, Event eventwaithandle ect., I am trying to understand Which threading mechanism or design pattern will be best fit for this requirement?

Aucun commentaire:

Enregistrer un commentaire