Windows Service

  • Thread starter Thread starter Priya Bange
  • Start date Start date
P

Priya Bange

Guest
Hi Experts,

Am still in learning phase of C#. How can I create a Windows service continuously running in background

Performing

1. Query SQL Server_1 table every 30 second.

2. Store the result in memory

3. After next run discard the old result and save new result in memory

4. The stored result in memory will be used to create multiple child processes of again querying other instances of SQL Servers

Let say,

SQL Server_1 table contains

1. SQL Server_N Server Details & Query to be executed on them.

2. Background process will read data from this table in SQL Server_1 every 30 seconds.

3. The result may contain 2-5 records. Each record in itself need to spawn a new child worker thread asynchronously performing query on the SQL Server instance details available in the result loaded into the memory for next 30 seconds continuously with a delay of based on Repeat_Frequency

Table example

SQL Server_1 SQL_Server_Instance_Details Query Repeat_Frquency
LocalHost_1 Insert INTO Table 2 values ('Xyz','Abc') Every 5 second
Localhost_2 Insert INTO Table3 values ('ABC',123) Every 3 second


Windows scheduler is not an option as it can't go under 1 minute. This design pattern I will be using for plethora of other tasks. Am just expressing it high level.

Apologies for such requirement. It will be supportive if solution for the same can be shared.

Thanks in advance

Priya

Continue reading...
 
Back
Top